I’ve just been asked by a community peer to write a script that will report on the utilization of cluster shared volumes on his Hyper-V environment.
Since they are using SCVMM, normally I would tell them to use the management pack for SCOM… but they’re not using SCOM.
So, here’s a oneliner that will show you the name of the host, the label of the disk and it’s utilization in %.
1 2 3 4 5 |
Get-VMHost | Get-VMHostVolume | Select-Object @{Label="Host";Expression={$_.VMHost}}, ` @{Label="Label";Expression={$_.VolumeLabel}}, ` @{Label="% Available";Expression={[Math]::Truncate(($_.Freespace * 100) / $_.Capacity)}} | sort-object "% Available" –Descending |
The output can be put in an weekly email or something like that… whatever you desire.
Hi Jeff,
Some remark, the above code is not against SCVMM but against FailOverClusterManager
Code for SCVMM is :
$vmmClusters = Get-scvmhostcluster -VMMServer
foreach ($vmmCluster in $vmmClusters) {
$vmmCluster.SharedVolumes.GetEnumerator() | Select @{l=’ClusterName’;e={$vmmcluster.name}},
@{l=’Freespace(GB)’;e={“{0:N2}”-f ($_.freespace/1gb)}},
@{l=’percentage(Available)’;e={“{0:N2}” -f ($_.freespace / ($_.Capacity/100))}}
}
Hi Wessel,
You’re correct. Thanks for the remark and code 🙂
Jeff.