Microsoft Cluster – Get group ownership information

Ok, there are probably several different ways you can get information about cluster group ownership, and I’ll try to post a “proper” script for doing this some other time. For now I just wanted to share with you the mother of all one-liners:

Get-WmiObject -namespace rootmscluster -class mscluster_resourcegroup -computer $computer -Authentication PacketPrivacy|Add-Member -pass ScriptProperty Node {Get-WmiObject -namespace rootmscluster -computer $computer -Authentication PacketPrivacy -query "ASSOCIATORS OF {MSCluster_ResourceGroup.Name='$($this.name)'} WHERE AssocClass = MSCluster_NodeToActiveGroup"|Select -ExpandProperty Name}|Select @{Name="Group";Expression={$_.Name}},Node,@{Name="Status";Expression={if($_.State -eq 0){"Online"}else{"Offline"}}}|ft -autosize

The only thing you have to do first is to populate $computer with the name of a cluster node.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s