asked on
Dim Strcomputer, strIPAddress
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select IPAddress From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
'Go through the IP addresses
For Each IPAddress In colItems
If IPAddress.IPaddress(0) <> "0.0.0.0" Then
strIPAddress = IPAddress.IPAddress(0)
Exit For
Else
Sendmessage "Info", "The computer is not connected to the Network" & vbNewLine &_
"Please attach to a connection on the Network and Rerun the program"
WScript.Quit
End If
Next
Wscript.echo "The IP Address Is " & "[ " & strIPAddress & " ]"