Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get IP Address for a cluster in Windows 2008 Server
    primarykey
    data
    text
    <p>I created a vbscript to obtain a bunch of system information from a server, and one thing I need to get is the IP Address of the server. Apparently I've only been getting the "heartbeat ip address", and that is not the one I need.</p> <p>Is there a way with vbscript for me to tie in with wmi and get the ip address, private one I assume.</p> <p>I tried this WMI class <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa371441(v=vs.85).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/windows/desktop/aa371441(v=vs.85).aspx</a></p> <p>Here is what I have</p> <pre><code>Option Explicit 'On Error Resume Next Dim strIPAddress,objItem,colItems,objWMISrvc,strComputer,objAddr strComputer = "." Set objWMISrvc = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &amp; strComputer &amp; "\root\cimv2") getIPAddress Sub getIPAddress() 'Check if system is a cluster' strIPAddress = "" Set colItems = objWMISrvc.ExecQuery("SELECT * FROM MSCluster_Network") If Err.Number &lt;&gt; 0 Then For Each objItem in colItems 'strIPAddress = "IP Address: " &amp; objItem. For i = 0 to UBound(objItem.IPv4Addresses) strIPAddress = "IP Address (" &amp; i &amp; "): " &amp; objItem.IPv4Addresses(i) Next Next End If '############################################################ ' These are all commented because this is how I WAS getting ' the ip address but it only returned the heartbeat. ' I will still be using this if I can somehow tell if a server is a cluster or not. 'If strIPAddress = "" Then '' Dim i '' Set colItems = objWMISrvc.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration") 'For Each objItem in colItems '' If Not IsNull(objItem.IPAddress) Then '' strIPAddress = objItem.IPAddress(0) '' 'For i = 0 to UBound(objItem.IPAddress) '' ' ' strIPAddress = strIPAddress &amp; " | " &amp; objItem.IPAddress(i) '' Next '' End If 'Next 'End If WScript.Echo strIPAddress End Sub </code></pre> <p>When my client ran this on their cluster server, it provided an empty msgbox, so it didn't pull an ip address.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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