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 returning 'null'
I tried with given my NIC card description with no imprvements.
\
wmiServ["ExecQuery"]("SELECT IPAddress FROM Win32_NetworkAdapterConfiguration where IPEnabled='True' and Description ='Intel(R) 82579LM Gigabit Network Connection'");
Help this novice guys ...
Am using this piece of code to fetch the IP ...
wmiServ["ExecQuery"]("SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'True'");
Which is returning 'null'
I tried with given my NIC card description with no imprvements.
\
wmiServ["ExecQuery"]("SELECT IPAddress FROM Win32_NetworkAdapterConfiguration where IPEnabled='True' and Description ='Intel(R) 82579LM Gigabit Network Connection'");
Help this novice guys ...
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.