Obtaining an IP address using @WMI and WMIQUERY

#1
While you can use @IPADDRESS to obtain the IP address of a specific host, you can also use @WMI and WMIQUERY. Example;

Code:
echo %@wmi[root\cimv2,"SELECT ProtocolAddress FROM Win32_Pingstatus where address='jpsoft.com'"]
or

Code:
wmiquery root\cimv2 "SELECT ProtocolAddress FROM WIN32_Pingstatus where address='jpsoft.com'"
Yes, @IPADDRESS returns the IP address much faster than @WMI and WMIQUERY, but this is just an example of doing the same thing using an alternate method.

You can see the other properties of Win32_PingStatus by visiting http://msdn.microsoft.com/en-us/library/aa394350%28v=vs.85%29.aspx

Joe
 
Sep 11, 2018
1
0
#2
While you can use @IPADDRESS to obtain the IP address of a specific host, you can also use @WMI and WMIQUERY. Example;

Code:
echo %@wmi[root\cimv2,"SELECT ProtocolAddress FROM Win32_Pingstatus where address='jpsoft.com'"]
or

Code:
wmiquery root\cimv2 "SELECT ProtocolAddress FROM WIN32_Pingstatus where address='jpsoft.com'"
Yes, @IPADDRESS returns the IP address much faster than @WMI and WMIQUERY, but this is just an example of doing the same thing using an alternate method.

You can see the other properties of Win32_PingStatus by visiting http://msdn.microsoft.com/en-us/library/aa394350%28v=vs.85%29.aspx

Joe
Thanks for being nice here. People like you are always there to help others.
This query totally worked and in the faster way than the other one once again thanks