When I wrote my previous blog post about blogging, I remembered how much of a sucker for the concept of recursion I'd become, even though it still bewilders me, after I'd read . I'd refer to it familiarly as GEB if I had a pointier head. Alas, my head is too round, and full of mush, and so I'm left to contemplate whether irony isn't a form of recursion in itself. I like irony.
Anyway, the other day I was searching the webz for a way to explore all of the WMI namespaces that are available on my machine, and I came across this PowerShell script that creates a GUI for exploring WMI namespaces. It's an awesome script, but I'm still wickedly amused by the idea of using PowerShell, something that at least partially was made accessible to get away from GUI administration, to create a GUI interface. Yes, yes, I know there's much more to PowerShell than that, but let me have my cheap thrills.
Anyway, if you, like the Incredible Hulk, think that 'GUI BAD!!!', then you can find out what WMI namespaces are available by getting the root namespace, and then looking at the __Namespace class, something like this:
gwmi -namespace "root" -class "__Namespace" | Select Name
Of course, as with most things PowerShell, there's more than 1 way to complete a task. If you've had a long day in PowerShell and find yourself pining for T-SQL, why not use a little WQL, or SQL for WMI, to find out the same information?
Get-WMIObject -namespace "root" -query "SELECT * FROM __Namespace" | Select Name
So, armed with the namespaces, what can you find out? Well, only what classes are in that namespace to explore, as the Powershell.com folks helped me figure out.
gwmi -namespace "root\WMI" -list
Got a favorite WMI class? I'm kind of partial to Win32_PingStatus and Win32_Service from the default namespace CIMV2 at the moment. I'm sure I'll have a different favorite tomorrow.