Question:
How can I get the IP address of the computer via scripts?
Solution:
To do so, you can write a script similar to the one in the following example:
strcomputer = “.”
Set objWMIService = GetObject(“winmgmts:” & “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”)
Set colItems = objWMIService.ExecQuery(“Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True”)
For Each objitem In colitems
strIPAddress = Join(objitem.IPAddress, “,”)
IP = Split(stripaddress, “,”)
Call MsgBox(IP(0))
Next