WMI: Getting started with WMI
Wondering how I figured out how to retrieve the Dell express service tag information? It’s actually pretty easy. First, grab a copy of Microsoft’s “ScriptomaticV2.hta” tool; download it, and bring up the interface. On opening, it automatically loads the “root\CIMV2” namespace, which contains all of the WMI classes that you’re going to want to query.
Next, I opened the WMI Class drop down box and poked around a bit… working under the assumption that any Dell-specific information is going to be hidden inside the “Win32_BIOS” class. Next, I ran the automatic script that Scriptomatic generated, and skimmed the output looking for a 7-digit express service tag number. Sure enough, “objItem.SerialNumber” pulls out the information I wanted.
Finally, I grabbed a copy of another script I had written to take command-line arguments, replacing what I had been using to some other work, with a Wscript.echo command for objItem.SerialNumber.
Between having a few scripts on hand that already do some useful stuff, and tools like Scriptomatic, you can really build some powerful little scripts that can have an immediate impact, without hours and hours worth of effort. Granted, this is a pretty basic script, but I can’t tell you how often it comes in handy.
No comments:
Post a Comment