CIM Class Types

Microsoft® Windows® 2000 Scripting Guide

It should be obvious at this point that classes are the basic building blocks in the CIM repository. WMI configuration information and WMI-managed resources are defined by one or more classes. Similar to the Active Directory schema, CIM classes are organized hierarchically such that child classes inherit properties, methods, and qualifiers from parent classes. (Properties, methods, and qualifiers will be covered in the next section of this chapter.)

For example, the Win32_Service dynamic class is inherited from the Win32_BaseService abstract class, which is inherited from the CIM_Service abstract class, which is inherited from the CIM_LogicalElement abstract class, which is inherited from the CIM_ManagedSystemElement abstract class, as illustrated in Figure 6.2. It is the sum of the classes in a class hierarchy that ultimately defines a managed resource.

Table 6.3 compares the non-system properties found in each of these classes. As you can see, child classes inherit all the properties from their parent class and typically include additional properties as well. Of course, this is why a software developer creates a new child class in the first place: because an existing class has many of the properties needed but not all of the properties needed. Rather than modify an existing class, the developer creates a new child class and adds properties to that child class.

Table 6.3 Comparing Parent and Child Class Properties

CIM_ManagedSystemElement and CIM_LogicalElement

CIM_Service

Win32_BaseService

Win32_Service

Caption

Caption

Caption

Caption

Description

Description

Description

Description

InstallDate

InstallDate

InstallDate

InstallDate

Name

Name

Name

Name

Status

Status

Status

Status

 

CreationClassName

CreationClassName

CreationClassName

 

Description

Description

Description

 

Name

Name

Name

 

Started

Started

Started

 

StartMode

StartMode

StartMode

 

Status

Status

Status

 

SystemCreationClassName

SystemCreationClassName

SystemCreationClassName

 

SystemName

SystemName

SystemName

 

 

AcceptPause

AcceptPause

 

 

AcceptStop

AcceptStop

 

 

DesktopInteract

DesktopInteract

 

 

DisplayName

DisplayName

 

 

ErrorControl

ErrorControl

 

 

ExitCode

ExitCode

 

 

PathName

PathName

 

 

ServiceSpecificExitCode

ServiceSpecificExitCode

 

 

ServiceType

ServiceType

 

 

StartName

StartName

 

 

State

State

 

 

TagID

TagID

 

 

 

Checkpoint

 

 

 

ProcessID

 

 

 

WaitHint

Does this mean that you can use Win32_BaseService to return information about services? No; Win32_BaseService is an abstract class, meaning that it is designed to serve as a template for other classes, not to return data.

Abstract Classes

An abstract class is a template used to define new classes. Like abstract classes in the Active Directory schema, CIM abstract classes serve as base classes for other abstract, static, and dynamic classes. Most WMI-managed resource class definitions are built (or derived) from one or more abstract classes.

You can identify an abstract class by examining the Abstract qualifier. An abstract class must define the Abstract qualifier and set the Abstract qualifier value to true.

The most common use of the abstract class type is to define core and common classes. Abstract classes are rarely used in WMI scripts because you cannot retrieve instances of abstract classes.

Static Classes

A static class defines data that is physically stored in the CIM repository. Static classes have instances just like dynamic classes; however, instances of static classes are stored in the CIM repository. Likewise, static class instances are retrieved directly from the CIM. They do not use a provider.

You can identify a static class by examining the class qualifiers. However, unlike abstract and dynamic class types that are identified by the presence of a specific qualifier, static classes are identified by the absence of the Abstract and Dynamic qualifiers. In other words, if a class has neither an Abstract nor a Dynamic qualifier, the class is a static class.

The most common use of the static class type is in the definition of system classes. Static classes are rarely used in WMI scripts.

Dynamic Classes

A dynamic class is a class that models a WMI-managed resource that is dynamically retrieved from a provider.

You can identify a dynamic class by examining the Dynamic qualifier. A dynamic class must define the Dynamic qualifier and set the Dynamic qualifier value to true.

The dynamic class type is typically used to define extension classes. Dynamic classes are the most common type of classes used in WMI scripts.

Association Classes

A fourth class type, known as an association class, is also supported. An association class is an abstract, static, or dynamic class that describes a relationship between two classes or managed resources. The Win32_SystemServices class, shown in Figure 6.2, is an example of a dynamic association class that describes the relationship between a computer and the services running on the computer.

You can identify an association class by examining the Association qualifier. An abstract, static, or dynamic association class must define the Association qualifier and set the Association qualifier value to true.