Share via


IIS WMI Provider Object Hierarchy

Each Windows Management Instrumentation (WMI) provider maintains its own namespace for classes that are specific to that provider. Each WMI provider namespace is a collection of class definitions that describe objects hierarchically in a domain. The namespace for IIS WMIprovider classes is MicrosoftIISv2. Script writers and programmers use the MicrosoftIISv2 namespace to read and configure the IIS metabase.

WMI Class Types

The classes defined in the MicrosoftIISv2 namespace correspond to the IIS metabase schema, which means that for every unique metabase key, there exists at least one WMI class defined for it. Most metabase keys have more than one WMI class defined for them: a WMI element class, containing read-only properties; and a WMI setting class, containing writable properties.

The following example shows the relationships between a few metabase keys and their corresponding WMI element classes (which have names identical to ADSI classes) and setting classes.

Generic Name Element Class Setting Class
Computer IIsComputer IIsComputerSetting
Web Service IIsWebService IIsWebServiceSetting
Web Server IIsWebServer IIsWebServerSetting
Web Virtual Directory IIsWebVirtualDir IIsWebVirtualDirSetting
FTP Service IIsFtpService IIsFtpServiceSetting

A third type of WMI class, the association class, exposes relationships between element classes and settings classes, and between element classes and other element classes.

The following sections describe the three types of WMI classes and how they are used.

WMI Element Classes

WMI element classes expose the following types of properties that cannot be changed, or written to:

  • Read-only properties belong to the element class.
  • Inherited properties belong to the parent class.
  • System properties belong to the system.

For example, the following are some of the unchangeable properties exposed by the WMI element class IIsWebVirtualDir:

  • Read-only: AppIsolated, AppPackageID, AppPackageName
  • Inherited: Caption, Description, InstallDate
  • System: _CLASS, _DERIVATION, _NAMESPACE

Because no WMI class contains read-only methods, WMI element class methods can be called and executed. For example, the IIsWebVirtualDir class methods, such as AppCreate, AppDelete, and AppUnload, can be called from a script or program.

You can use WMI element classes to do the following:

  • Navigate or enumerate objects.
  • Create new metabase nodes.
  • Call methods.
  • Query read-only properties.

WMI Setting Classes

WMI setting classes expose read/write properties, which you can change using a script or program. Setting classes do not contain methods.

For example, the IIsWebVirtualDirSettings setting class, a counterpart to the IIsWebVirtualDir element class, exposes the following writable metabase properties, in addition to others:

  • AccessFlags
  • AccessSSL
  • AspSessionTimeout
  • CacheISAPI
  • HttpRedirect

When setting metabase properties directly, use the setting classes. You need only use WMI element classes to read information. In the JScript code example below, a script uses the IIsWebVirtualDirSetting setting class to set the AccessFlags metabase property to zero. Note that no element class is used in the script.

  var providerObj = GetObject("winmgmts:/root/MicrosoftIISv2");
var vdirObj = providerObj.Get("IISWebVirtualDirSetting='W3SVC/1/ROOT'");
vdirObj.AccessFlags = 0;
vdirObj.Put_();

You can also use WMI setting classes to set writable metabase properties.

WMI Association Classes

WMI element classes may be associated with other element classes or with setting classes. These associations are themselves classes. You can use WMI association classes to find element or setting objects associated with any element object. Association class names are distinguished by an underscore separating two names, such as IIsComputer_IIsComputerSetting or IIsComputer_IIsMimeMap.

The following list illustrates some of the associations of the element class IIsWebVirtualDir:

  • IIsWebVirtualDir_IIsWebVirtualDirSetting (associating with its counterpart WMI setting class),
  • IIsWebVirtualDir_IIsWebDirectory (associating with the WMI element class for Web directories),
  • IIsWebVirtualDir_IIsIPSecuritySetting (associating with the WMI setting class for Internet Protocol security),
  • IIsWebVirtualDir_IIsWebVirtualDir (associating parent-to-child with one virtual directory containing other virtual directories).

Association classes allow you to easily find associations between an instance of a WMI element class and instances of associated WMI classes. For example, using the association of IIsWebDirectory and IISWebFile, you can find the IP security settings (IPSecuritySetting) for each of the files contained in a Web directory.

Similarly you can find all the child classes of an element class. For example, to find the child classes of a Web virtual directory, use the association class IIsWebVirtualDir_IIsWebVirtualDir.

  • For basic IIS WMI provider instruction and sample scripts that use WMI setting classes, see the IIS WMI Provider Tutorial.
  • To download the WMI SDK, which contains WMI reference material and WMI object browsing tools, see the MSDN Web site, and search on "WMI."