I’ve just released a WMI/PHP library which will allow you to easily WMI query Windows machines from your Linux server via PHP. It is somewhat of an extension of the CactiWMI project as it used that code base as a reference for the query and processing of the returned data. Whilst there are a number of libraries in existence for this purpose on Windows there appeared to be none for when running PHP on Linux.
So why has this all come about. In my job I’ve been working on a small helpdesk type application written in PHP. The idea being that it presents all the information about the user, computer and helpdesk ticket that we are working on in one place. It also provides a quicker interface for searching information than the existing systems on their own. For this I needed to be able to hook into Active Directory, the MSSQL job tracking DB and of course WMI data for the remote PC. All this from the Linux based server.
So I branched off some code from the CactiWMI project and initially wrote it as a simple wmi() type function to run basic queries against remote machines. This quickly became a bit of a pain as I needed to add more arguments to allow filters and then more code to decide if a filter had been supplied or not etc so dumped it and rewrote it into a WMI object.
Now what we have is a reasonably simple library which you can include into your project, create the WMI object and throw some queries at hosts. The data returned at the moment is a little rough as its just a numerically indexed multi dimensional array but should make iteration very easy. I’ll be looking for suggestions as to what I can improve as it’s the first library like this I have had to write and I’ve probably made plenty of rookie mistakes.
I’ve attached a copy of the current stable release and an example file which should get people started until I can add some documentation. I may look at releasing the helpdesk app as well as it’s come in quite useful
SVN Repository is located here http://svn.parkingdenied.com/PHPWMILib/
PHPWMILib-0.0.2.r4.tar.gz (13.3 KiB, 271 hits)
example.zip (569 bytes, 257 hits)




{ 2 } Comments
Nice 1… Even though i never used php before, it is useful for me
Thanks
Thanks! Was looking for someting like this to work with setting up some IIS websites from a linux based control panel. Should save a bunch of time.
Post a Comment