wmi2php

I’ve been playing with my NLB cluster and want to use WMI to control the nodes. The PHP COM library works great, and I’ve had some success. The properties of COM objects aren’t exposed to you, so if  you print_r($somevar), you get nothing. I’ve been using ScriptomaticV2 and the NLB WMI documentation to muddle through it, and I found I was doing a lot of copying and pasting. Well no more! I worked through the major methods in Scriptomatic and re-implemented them in PHP. Now I can export PHP class files for any WMI class.

Check it out in GitHub.

It should be noted that I’m not a huge fan of “getters and setters”, so this uses overrides and an array of valid properties. I’m planning to expand it to create more “native” classes.

So now I can:

wmi2php.php generate --namespace=root/CIMV2 --class=Win32_ComputerSystem

Enjoy.

Advertisements

About robertlabrie
DevOps Engineer at The Network Inc in metro Atlanta. Too many interests to list here, check out my posts, or look me up on LinkedIn

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: