Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Cluster Resource "Cluster Disk" fetching the data

Listing status for resource 'SQL Server (CLUSTER)':

Resource Group Node Status


Cluster Disk Cluster Disk Node1 Online

How can i parse the Node name here or is there some other command which would help me fetch it?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Windows Server 2008 R2 and higher include a Powershell module for failover clusters, however they are not backward compatible with Windows Server 2008 or 2003. I prefer to use WMI which supports all OS versions and does not require parsing. Here's how to list resources and active node using WMI:

 $cluster = "myCluster"
 gwmi -ComputerName $cluster -Authentication PacketPrivacy -Namespace "root\mscluster" -Class MSCluster_Resource |
  add-member -pass NoteProperty Cluster $cluster | 
    add-member -pass ScriptProperty Node {
     gwmi -namespace "root\mscluster" -computerName $this.Cluster -Authentication PacketPrivacy -query "ASSOCIATORS OF {MSCluster_Resource.Name='$($this.Name)'} WHERE AssocClass = MSCluster_NodeToActiveResource" |
      Select -ExpandProperty Name } | select name, node
share|improve this answer
    
Thanks, this helped! –  Nida Sahar Nov 4 '12 at 17:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.