ryamigo Posted February 25, 2011 Share Posted February 25, 2011 Hello, I'm attempting to write a PHP script to query WMI for an IP address of a host. The reason I'm doing this instead of getbyhostname is because NAT translations on the network can cause inaccurate results. The question is two-fold: 1) My Script is as follows <? $obj = new COM ( 'winmgmts://localhost/root/CIMV2' ); $wmi_network = $obj->ExecQuery("Select * From Win32_NetworkAdapterConfiguration"); foreach ( $wmi_network as $wmi_call ) { $ipaddr = $wmi_call->IPAddress; echo $ipaddr; } ?> I get the following error when running the script: Catchable fatal error: Object of class variant could not be converted to string 2) How do I go about querying a remote host on the network with valid credentials? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/228815-php-and-wmi-querying-for-ip-addresses-on-remote-hosts/ Share on other sites More sharing options...
ryamigo Posted March 3, 2011 Author Share Posted March 3, 2011 Bump? Quote Link to comment https://forums.phpfreaks.com/topic/228815-php-and-wmi-querying-for-ip-addresses-on-remote-hosts/#findComment-1182374 Share on other sites More sharing options...
Muddy_Funster Posted March 3, 2011 Share Posted March 3, 2011 you can't do it with PHP, it is run purely server side, you would need javascript or possably ajax. Although I can't think of a single legal reason you could have to be trying to obtain this information without simply enquiering from the person using the computer that you want the local IP address of. P.S. Bumping posts is against the rules. Quote Link to comment https://forums.phpfreaks.com/topic/228815-php-and-wmi-querying-for-ip-addresses-on-remote-hosts/#findComment-1182379 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.