PowerShell / WMI: Free Disk Space from a Cluster Shared Volume (CSV) in a Windows Failover Cluster

There are a great set of PowerShell cmdlets for Failover Clusters, but what if you just want some information about your Cluster Shared Volumes on a  remote computer without installing those cmdlets?  There’s an easy way with WMI.

Get-WmiObject -Impersonation Impersonate -Authentication PacketPrivacy -ComputerName "SERVERNAME" -Namespace "root\MSCluster" -class "MSCluster_DiskPartition" | where {$_.VolumeLabel -eq "VOLUMENAME"} | select -first 1 | select -Expand FreeSpace

In the above snippet, change SERVERNAME to one of the cluster nodes and VOLUMENAME to the volume label of the CSV you want to examine.  Of course, you don’t have to select a single volume if you want information from all the cluster volumes.  I did it this way because I only wanted to look a the CSV and not the quorum drive.  The above returns a single integer representing the free space for use later on in my script.

The impersonation and authentication settings are required for remote access but not local access.

Adapt the above to suit your needs. :-)