Jump to content

WMI via PHP


Nathan_V

Recommended Posts

I'm trying to access WMI via a PHP page to hopefully at minimum pull status messages via WMI for display on a webpage.  Eventually I want to get WMI set up for SET as well as GET so that I can change status messages in WMI via the page.  Even better if I can dump results to SQL and only query WMI when necessary since it's not a very quick process.  The final result *should* list information on the VMs hosted on a Server 2008 Hyper-V system.

 

I've been trying to use the EasyWMI class (http://www.phpclasses.org/browse/file/23238.html) to accomplish this.  So far I had to add a case so that I can connect to the \\root\virtualization namespace in WMI.  That's easy enough but I can't seem to figure out how to execute the class to accomplish what I want.  The documentation on this class isn't 100% complete and I'm a bit rusty on my PHP so I'm having a hard time getting the exact results I want.

 

I want to be able to access \\root\virtualization:Msvm_ComputerSystem and get the data from each instance.  Ideally the complete command run against \\root\virtualization would be "select * from Msvm_ComputerSystem" to pull the data back.  I believe it's supposed to return the results as an array (as it's set up from the author) which is fine since I can create the logic to parse that well enough.

 

What I don't understand in the out-of-the-box class is that if I want to call it how exactly I should do that from another php page.

 

 

 

How do I get the result of the query?  ???

 

Thank you!

Link to comment
https://forums.phpfreaks.com/topic/123707-wmi-via-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.