I had a comment left by Ryan on this post http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!983.entry regarding the difference between Get-WmiObject and [WMIClass] especially when you need to create a new object via WMI.
The code that Ryan has produced is worth looking at - see http://www.dagey.net/wordpress/2008/07/08/powershell-madness-part-1/
The important thing to remember is that PowerShell is .NET based and underneath the cmdlets and accelerators we are dealing with .NET classes. PowerShell gives us a layer of abstraction that hides some of the more nasty programming type stuff ;-)
Ryan's post regarded using WMI on IIS 7 but for this discussion I will use Win32_Process and notepad as it is more straight forward and is definitely something you will be able to try at home.
If we start with Get-WmiObject.
Get-WmiObject is used to read information about and in some cases perform actions upon an existing WMI object. If we create a WMI object pointing to an existing and open instance of notepad (what would we do for examples if notepad didn't exist)
PS> $g = Get-WmiObject -Class Win32_Process -Filter "Name = 'notepad.exe'"
PS> $g | Get-Member
and then use get-member on it we see that it is returning a System.Management.ManagementObject of a Win32_Process WMI Class. If you look at the properties and methods shown by get-member there is no method to create an instance. More information on this class at http://msdn.microsoft.com/en-us/library/system.management.managementobject.aspx
It is like picking a cup of coffee off a counter where there are many cups of coffee. It is in existence and usable (drinkable) but you can't use it to create a cup. My analogy breaks down slightly as there is a clone() method if we drop into the base object but that appears to clone the object rather than a new instance of notepad so we will leave that to one side.
If we now look at [WMIClass] and use get-member on it
PS> $c = [WMIClass]'Win32_Process'
PS> $c | Get-Member
We see that we are using a different .NET class System.Management.ManagementClass - see http://msdn.microsoft.com/en-us/library/system.management.managementclass.aspx Reading this shows there is a way to create a new instance of the class via CreatInstance() method.
Get-member shows us a create() method and
PS> $c.psbase | Get-Member
shows us the createinstance() method that matches the .NET documentation either will work.
Is the simplest to use and will create a new process running notepad.
Using [WMIClass] is a shortcut for using New-Object
$x = New-Object -TypeName System.Management.ManagementClass -ArgumentList "Win32_Process"
$x | Get-Member
To summarise Get-WmiObject is a PowerShell cmdlet to work with the System.Management.ManagementObject .NET class which allows you to read information from and interact with existing instances of WMI Classes. [WMIClass] is a shortcut (or accelarator) for creating new instances of WMI classes.
Hope this clears the differences