In this post http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1525.entry I talked about the difference between Get-WmiObject and [WmiClass]. I've had a comment left asking "But how do you know that there is Win32_Process inside this class?!?!?"
This question could have several meanings. What I did in the post was a bit of a circular argument as I started with Win32_Process deliberately - mainly because it and notepad should be available to everyone working with PowerShell. So I know that the class is Win32_Process because thats how I set it up to be.
WMI classes are not the same as .NET classes. WMI is COM based. We can access it through the System.Management.xxxx .NET classes which is what we are working with when we use the PowerShell WMI commands.
In the wider context how do I know that windows processes are represented by Win32_Process. Partly its experience - I've been working with Windows and WMI for a long time. How long did you ask? Hmmmm, I could tell you but...........
The other way to discover what the WMI classes represent is to dig into them.
will give you a list of WMI classes in the cimv2 namespace which is where most of the common Windows admin WMI classes sit. The names are often self describing. Have a try of them with Get-WmiObject - its read only so you won't damage your system.
Other methods include:
- PowerShell scriptomatic from http://www.microsoft.com/technet/scriptcenter/tools/psomatic.mspx
- WMI Reference information from http://msdn.microsoft.com/en-us/library/aa394572.aspx
Hope this helps
|Share this post :|