[WMICLASS] – a short cut to a WMI Class definition to enable access to the class’s static properties and methods. I describe this type accelerator below.

[WMISEARCHER] – a short cut to .NET’s ManagementObjectSearcher enabling you to search for objects easily. This type accellerator is an opportunity for a future article.

The [WMICLASS] type accelerator takes a string containing a relative or absolute path to an WMI class, and returns a a System.Management.ManagementClass object that represents the specified class (as opposed to an occurance of that class). For example let’s take a look at the Win32_Share WMI Class. First, look at what Get-WMIObject returns, then look at what the [WMICLASS] type accelerator returns:

In this example, you can see that Get-WMIObject returns System.Management.ManagementObject objects, while [WMICLASS} returns System.Management.ManagementClass objects – in other words, different object types with different members. I note that the MSDN library documentation does not really differentiate static and object members clearly – so you just have to know which is which when dealing with WMI classes.
The object occurrences returned from Get-WMIObject contain three methods: Delete, GetAccessMask and SetShareInfo. These three methods operate on a particular occurrence, i.e. Delete means “delete this occurrence”. However, the object returned from [WMICLASS} both contains none of those three dynamic methods, but does create a static method: Create, i.e. create a new share.
Why bother with [WMICLASS] you might ask. The answer is simple: to access the static methods and properties/fields that the class exposes. In the case of theWin32_Share class, the class has a static method (create) and three dynamic methods( delete, GetAccessMask and SetShareInfo). If you want to create a new share, then use [WMICLASS] to get access to the create method. You can get access to the Delete method by getting the appropriate method. This bit of code illustrates this:

.SYNOPSIS Demonstrates WMI and Win32_Share.DESCRIPTION This script looks at objects retured from Get-WMIObject, and [WMICLASS] and demonstrates the use of a static method (create) and a dynamic or object method (delete). .NOTES Author : Thomas Lee - tfl@psp.co.uk.LINK http://www.pshscripts.blogspot.com.EXAMPLE Left as an exercise for the reader#>

# Display final results"";"Foo at the end:"$finish = get-wmiobject win32_share | where {$_.name -match "foo"}if ($finish) {"{0} foo shares at the end, as folllows:" -f $start.count; $start} else {"No foo shares at the end:"}""This sample, after the now obligatory Advanced Function help stuff, obtains and displays any shares on the local system that contain the string “foo”. Then, in line 24 the scripts gets the Win32_Share class, and in line 25 used the create static method to create a new share (Foo22). In line 39, the script deletes the newly added share, and finally prints out the remaining shares matching “foo”.In summary, the [WMICLASS] gives you access to the static methods or members exposed by a WMI class.

Hung, I think you may have misunderstood my post. WMI classes can have static methods, not available from an instance. The Win32_Share class, as illustrated on this article is one example. You do NOT need to create an instance in order to access the class's static methods. You can use the [WMICLASS] type accelerator to get to the static method. HTH

Dude. This web page just started playing a radio commercial for a car dealership. What the hell? (Google Chrome showed the audio icon in the tab for this page. As soon as I switched focus back to it, it stopped.)