Logging Module Enumerator

Multiple logging modules can lead to multiple headaches if you aren't prepared. This sample tool illustrates some techniques you can use to create logging management tools of your own.

This tool serves two separate functions. If it is invoked without command-line arguments, then it simply lists all logging modules that currently have entries in the metabase on your server. If an ADsPath is given, such as IIS://LocalHost/W3SVC/3, then the tool will try to determine what is considered the active logging module for that metabase node, and will give you information about that logging module.

To list the available logging modules, the GetObject method is invoked to gain access to the IIS://LocalHost/Logging node of the metabase. A For ... Each loop is then used to enumerate the modules that are founded in that node.

Gathering information about a specific server's logging module is a bit more involved. The difficulty arises because the only property at the server level that indicates what logging module is currently in use by the server is the LogPluginClsId property. This value must be compared to each and every module listed at the //LocalHost level until a match is found.

GetObject is used to gain access to the list of logging modules provided at the //LocalHost level. The CLISID of the logging module is compared to the CLSID of each logging module provided in this main list until a match is found. When a match is found, the script tells you all it can about the logging module; if no match is found between the CLSIDs, the script aborts with an error.

This sample is provided for educational purposes only. It has not been tested in a production environment, and Microsoft® will not provide technical support for it.

This script is available in the Internet services directory, at ...\iissamples\sdk\admin\logenum.vbs.


© 1997 by Microsoft Corporation. All rights reserved.