So last time, we saw how we could pull up this monster list of WMI objects and throw them into a CSV file to see just what objects were available.
But we’d like to do something a little useful with the WMI Objects.
We can pull out a multitude information from various WMI Objects. And you can send commands to WMI objects as well (certain ones)
So how do you see what you can get?
For the most part, WMI Objects are pretty descriptive about what they might contain. To pull information from a WMI Object in Powershell, the basic method is to type
GET-WMIOBJECT WMIOBJECTNAME
Now this is not the only parameters you can type in, but this is just to give you a feel for what you can do.
So if we type in
GET-WMIOBJECT WIN32_BIOS
We’ll get an output similar to
Which tells us the revision of the BIOS on this particular computer, my service tag (No, it’s not REALLY 7654321 and I’m not telling you what it is) and EVEN the manufacturer of the BIOS.
Or
GET-WMIOBJECT WIN32_OPERATINGSYSTEM
Will quickly yield results like
But there’s a lot more to WMI Objects. If you pipe the last command through a “GET-MEMBER” to see what’s REALLY available you’ll get a list of Properties accessible well beyond this small piece displayed.
Here’s a few Examples.
(GET-WMIOBJECT WIN32_OPERATINGSYSTEM).Installdate
Yields the date you installed (or somebody did at least) the operating system
(GET-WMIOBJECT WIN32_OPERATINGSYSTEM).CSName
Gives the NETBIOS or Computer name. With WMI Objects we can even tell a system to reboot.
(GET-WMIOBJECT WIN32_OPERATINGSYSTEM).Reboot()
Because WMI Objects not only contain information, it’s also a controlling interface. Reboot is a “METHOD” which is a special type of property. It can DO things do the Object, whether it is to send information or modify the outcoming content.
This is not an End all Be all introduction to WMI. All this is meant to do is introduce you to Powershell and how you might be able to use it to access and work with WMI.
Remember, Powershell is not the ONLY way to do it, but it is another tool to arm yourself with and make yourself more productive.
Cheers
Sean
The Energized Tech




Leave a comment