0
votes

I am looking for a powershell command that will pull the free space of a Cluster Shared Volume as it does not have a logical drive letter on a remote system. The Following is the Command I use on Logical Drives so you can see an example of the output I am Looking for. I am looking for just a numeric value of available megabytes.

Get-WMIObject -computer server -filter "DeviceID = 'C:'" Win32_LogicalDisk | 
              ForEach-Object {[math]::truncate($_.freespace / 1MB)}

Thanks in advance for your Help!

1

1 Answers

0
votes

You can't determine the free space of a Cluster Shared Volume (CSV) on a per-host basis. CSVs are cluster-shared resources, so you need to use cluster tools for obtaining information about them:

$cluster = 'Cluster Name'
$volume  = 'Cluster Shared Volume Name'

Import-Module failoverclusters

Get-ClusterSharedVolume -Name $volume -Cluster $cluster `
  | select -Expand SharedVolumeInfo `
  | select @{n='FreeSpace';e={($_.Partition.Size - $_.Partition.UsedSpace)/1MB}}