Exploring WMI classes
A WMI class defines a WMI-managed object. All WMI classes live within a namespace and contain members that include properties, methods, and events. An example class is Win32_Share
, which you find in the ROOT\CIMV2
namespace. This class defines an SMB share on a Windows host. Within WMI, the Win32 provider implements this class (along with multiple other OS and host-related classes).
As mentioned, you typically use the SMB cmdlets to manage SMB shares (as discussed in Chapter 10, Managing Shared Data, including the Creating and securing SMB shares recipe). Likewise, you carry out most AD management activities using AD cmdlets rather than accessing the information via WMI. Nevertheless, you can do things with WMI, such as event handling, that can be very useful to the IT professional.
A WMI class contains one or more properties that are attributes of an occurrence of a WMI class. Classes can also include methods that act on a WMI occurrence. For example...