Hyper-V Cluster - Get CSV Usage
Why
My daily tasks include maintaining a few Hyper-V Clusters (and other Failover Clusters). All of them are using CSV (Cluster Shared Volumes) - whether it’s 2012R2 cluster with SAN or 2016 with S2D.
While in the middle of something (moving VMs, load balancing resources, creating new ones) I need the information of current utilization of my CSVs. This can also be useful when I need to deploy a new VM - query storage with least utilization.
How
- I can get the information from Failover Cluster Manager:
- I can get it using Windows Admin Center
- or I can get it through PowerShell
The PowerShell Way
There’s a Cmdlet from FailoverClusters module that can provide us with all the information - Get-ClusterSharedVolume
:
It’s rather not very detailed, but Get-Member will reveal what’s inside:
SharedVolumeInfo
Property looks promising:
Partition property is also an object, which holds very valuable information:
Now I have all the information I need.
As I mentioned before - I tend to use alternative credentials to access critical resources. Unfortunately Get-ClusterSharedVolume
doesn’t accept Credential
parameter. So despite it’s possible to query cluster directly, I’d rather use Invoke-Command
to access cluster information. This way I can connect cross-domain as well.
Final
Let’s wrap it up into a function and see how it goes:
And the output:
This comes quite handy for a quick glance:
Leave a comment