vishwas_n
12 years agoOccasional Contributor
IP Address fetching for remote machine using C#Script
Fellas, Am using this piece of code to fetch the IP ... wmiServ["ExecQuery"]("SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'True'"); Which is returnin...
- 12 years ago
Hi Vishwas,
The following code, posted in this thread, works for me:
Sub LogIPAddress
strQuery = "select * from Win32_NetworkAdapterConfiguration where IPEnabled=True"
Set colItems = GetObject("winmgmts:").ExecQuery(strQuery)
Log.Message sys.HostName
For Each objItem In colItems
Log.Message(objItem.DNSHostName)
Log.Message(objItem.IPAddress(0))
Next
End Sub
If it doesn't work, check the WMI settings on the computer.