Connecting to WMI with PHP
(Page 1 of 5 )
WMI (Windows Management Instrumentation) is a very powerful tool for anyone who runs their own server on a win32 platform. It can provide you with many pieces of information that you’d never thought possible. Beyond that you can even control almost every aspect of your system with WMI. Couple that with PHP and you’ll have the power to perform almost any type of action you’d like on your server.
Getting Started
WMI uses the Common Information Model, which is an industry standard to represent systems, applications, networks, devices, and other components. This means that you can have it show all kinds of useful information such as what programs are running, how much ram is being used, network activity, even how many hard drives are installed on your system. Almost every Windows system since Windows 2000 has WMI capabilities, and it can be downloaded for earlier systems from Microsoft’s website. All you have to do to turn it on is open a command prompt then execute the command “WMIC”. It will take a few minutes to start if you’ve never used WMI on your system before because it has to install all the services needed to run WMI.
It would seem fairly simple to just run an exec() in PHP and retrieve whatever data you wanted to from the command line, but it’s not exactly that easy. The first thing to do is figure out exactly what information you want, and what you want to do with it. Then you’ll have to figure out the best way to make WMI format your information. And lastly you’ll have to get PHP to send the query to the WMI, retrieve the data, and output it in a way that will be organized and easy to understand. You’ll also want to do a little more research on WMI before you get started. I recommend the Microsoft Developer Network’s website on WMI, which can be found here http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_start_page.asp
Next: The Newest SQL Slang >>
More Windows Scripting Articles
More By James Murray