Powershell命令确定远程Windows服务器上群集共享卷的可用空间

时间:2014-02-11 15:57:24

标签: windows powershell cluster-computing hyper-v diskspace

我正在寻找一个powershell命令,它将拉动群集共享卷的可用空间,因为它在远程系统上没有逻辑驱动器号。以下是我在逻辑驱动器上使用的命令,因此您可以看到我正在寻找的输出示例。我正在寻找可用兆字节的数值。

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

提前感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

您无法基于每个主机确定群集共享卷(CSV)的可用空间。 CSV是群集共享资源,因此您需要使用cluster tools来获取有关它们的信息:

$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}}