Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First and foremost, you need the <code>mscluster</code> namespace, not the <code>cimv2</code> namespace.</p> <pre><code>Set cluster = GetObject("winmgmts://./root/mscluster") </code></pre> <p>Second, what <strong>is</strong> the address you need? A cluster usually has several networks with separate IP address ranges. The <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa371441%28v=vs.85%29.aspx" rel="nofollow"><code>MSCluster_Network</code></a> class allows you to enumerate the networks and their network addresses:</p> <pre><code>For Each nw In cluster.ExecQuery("SELECT * FROM MSCluster_Network") WScript.Echo nw.Name &amp; vbTab &amp; nw.Address Next </code></pre> <p>The output should be something like this (note the <code>0</code> in the last octet, which is the network address, not an actual host address):</p> <pre><code>iSCSI 192.168.26.0 Live Migration 192.168.25.0 Management 192.168.23.0 Heartbeat 192.168.24.0 </code></pre> <p>If you want the IP addresses of an individual cluster member, you can get them via the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa371442%28v=vs.85%29.aspx" rel="nofollow"><code>MSCluster_NetworkInterface</code></a> class:</p> <pre><code>hostname = "foobar" For Each iface In cluster.ExecQuery("SELECT * FROM MSCluster_NetworkInterface") If Left(iface.Name, Len(hostname)) = hostname Then WScript.Echo iface.Name &amp; vbTab &amp; iface.Address End If Next </code></pre> <p>which should produce output like this:</p> <pre><code>foobar - iSCSI-0 192.168.26.17 foobar - Live Migration 192.168.25.23 foobar - Management 192.168.23.42 foobar - Heartbeat 192.168.24.13 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload