Login to participate
Endpoint Management & Virtualization BlogsRSS

Gathering IIS Information Using Custom Inventory

dougj's picture

The following custom inventory will query WMI for IIS virtual directories. The custom inventory will return the virtual directory name and the physical path it points to. Other WMI classes in this name space returned the virtual directory name but this is the only one found to include the path, so it was chosen for this example.

Microsoft includes a WMI provider for IIS. This information is in the root\MicrosoftIISv2 namespace, rather than the root\cimv2 namespace, which we usually tend to utilize in custom inventories. Check with Microsoft for other names for this namespace as it appears to have a version embedded in the name. You may need to update the wmi query to suit your own environment. You also may need multiple copies of this custom inventory source file and corresponding collections, policies, and so on, if different versions of IIS are installed in your environment.

Also, there are many other properties in this WMI class that may or may not prove helpful.

<InventoryClasses>
<InventoryClass name='iis virtual directory' manufacturer='Altiris' description='' version='1.0' platform='Win32' mifClass='Altiris|MyCustomClass|1.0'>
<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
<s:Schema id="RowsetSchema">
 <s:ElementType name="row" content="eltOnly" rs:updatable="true">
  <s:AttributeType name="c0" rs:name="Name" rs:number="1" rs:nullable="true" mifAttrId="1">
   <s:datatype dt:type="string" dt:maxLength="255"/>
  </s:AttributeType>
  <s:AttributeType name="c1" rs:name="PasswordExpirePrenotifyDays" rs:number="2" rs:nullable="true" mifAttrId="2">
   <s:datatype dt:type="string" dt:maxLength="255"/>
  </s:AttributeType>
 </s:ElementType>
</s:Schema>
<rs:data>
 <%foreach wmiobject="o" namespace="root\MicrosoftIISv2" wql="SELECT * FROM IIsWebVirtualDirSetting" %>
  <z:row 
   c0 ="<%writexml "wmi:o.Name"%>"
   c1 ="<%writexml "wmi:o.Path"%>"
  />
 <%next%>
</rs:data>
</xml>
</InventoryClass>
</InventoryClasses>
SK's picture

Not all virtual directories are returned..

Unfortunately this does not return all virtual directories that can be found under the Default Web Site when run on a NS box.

I have found a VBS file that does do this however, and just need to know how to add the VBS components that will create an NSI file.