ozmoeugene
IS-IT--Management
Can someone tell me why the following script is not working?
This script is right out of the book and does not work:
SCRIPT Below:
Set myObj = GetObject("winmgmts:{impersonationLevel=impersonate}" & _
"!//localhost".ExecQuery _
("select IPAddress from Win32_NetworkingAdapterConfiguration" & _
" where IPEnabled=TRUE")
'Go through the addresses
For Each IPAddress in myObj
If IPAddress.IPAddress(0) <> "0.0.0.0" Then
LocalIP = IPAddress.IPAddress(0)
Exit For
End If
Next
MsgBox LocalIP
Thanks ahead of time.
This script is right out of the book and does not work:
SCRIPT Below:
Set myObj = GetObject("winmgmts:{impersonationLevel=impersonate}" & _
"!//localhost".ExecQuery _
("select IPAddress from Win32_NetworkingAdapterConfiguration" & _
" where IPEnabled=TRUE")
'Go through the addresses
For Each IPAddress in myObj
If IPAddress.IPAddress(0) <> "0.0.0.0" Then
LocalIP = IPAddress.IPAddress(0)
Exit For
End If
Next
MsgBox LocalIP
Thanks ahead of time.