Locating the WMI classes for IIS 6.0
All classes of the IIS 6.0 WMI provider are contained in a namespace called MicrosoftIISv2. This namespace is made up of five different classes discussed briefly in the next few sections.
CIM_ManagedSystemElement
The CIM_ManagedSystemElement class contains elements that relate to the IIS metabase schema. An example of one of these classes is IISWebServer, which maps to an instance of an IIS Web server. Another class is IISWebVirtualDir, which maps to an instance of a Web virtual directory. The elements in CIM_ManagedSystemElement are read-only. To set these types of settings, use the CIM_Setting class.
CIM_Setting
The elements in the CIM_Setting class map closely to the elements in the CIM_ManagedSystem Element class. This means that the elements correspond to nodes of the IIS 6.0 metabase schema. The CIM_Setting class contains methods that enable you to work with the properties that match the read-only elements of the CIM_ManagedSystemElement class.
Tip  | The IIsWebServerSetting element in the CIM_Setting element class enables you to make changes to your IIS Web server. To view data, you use the IIsWebServer element in the CIM_ManagedSystemElement class. It is important to remember that both of these elements refer to Web sites on your server. IIsWebServer is read-only, and IIsWebServerSetting enables you to make changes. |
IIsStructuredDataClass
The IIsStructuredDataClass class presents information that is also accessible via Active Directory Service Interfaces (ADSI). However, the IIsStructuredDataClass information is structured in a way that is easier to work with than the ADSI data. For instance, the ServerBinding's property in ADSI is a string that consists of "IP:Port:Hostname". If the parts are out of order or are missing colons, an error occurs. By using IIsStructuredDataClass, you can take advantage of the element class called ServerBinding, whose properties are easier to set.
CIM_Component
CIM_Component is an association class that maps each element in the CIM_ManagedSystem Element class to other elements in the same class. It does this to mimic the way the data would be accessed via ADSI.
CIM_ElementSetting
The CIM_ElementSetting class is also an association class. As such, it maps elements in the CIM_ManagedSystemElement class to elements in the CIM_Setting class. The properties of the elements contained in the CIM_ElementSetting class are simply references to the two associated elements.
Using MicrosoftIISv2
To use the MicrosoftIISv2 namespace, you need to understand the way the five classes represent the structure of the IIS 6.0 metabase schema. Instances of the elements in each of the classes contain current information that is viewable via the IIS Manager or the Metabase Configuration Editor.
On a default installation of IIS 6.0, the IIsWebVirtualDir element of the Cim_ManagedSystem Element class contains three instances of virtual directories: W3SVC/1/Root, W3SVC/1/Root/Scripts, and W3SVC/1/Root/Printers. These three virtual directories are also represented in the IIsWebVirtualDirSetting element of the CIM_Setting class. The only difference between the two is that you make changes to the virtual directories using only IIsWebVirtualDirSetting.
Just the Steps  | To connect to the MicrosoftIISv2 namespace
1. | Define a variable to hold the object that comes back from the connection.
| 2. | Specify the namespace as /root/MicrosoftIISv2.
| 3. | Set your variable equal to the object that comes back from using the GetObject command to connect through winmgmts to the root/MicrosoftIISv2 namespace on your machine.
| 4. | Use the ExecQuery method to obtain information.
|
|
|