Hyper-V Cluster - Get CSV Usage

1 minute read

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:

FCM

WAC

  • 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:

Get-CSV

It’s rather not very detailed, but Get-Member will reveal what’s inside:

Get-CSV

SharedVolumeInfo Property looks promising:

Get-CSV

Partition property is also an object, which holds very valuable information:

Get-CSV

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:

Output

This comes quite handy for a quick glance:

Output

Leave a comment