ActiveXperts Network Monitor
Monitor servers, workstations, devices and applications in your network

Quicklinks


Scripting Internet Information Server 6.x Logging

List All FTP Log Modules
List Custom Log Modules
List Custom Log Module Properties
List IIsLogModulesSetting Instances
List IIsLogModule Instances
List Log Modules
List Log Module Settings
List Web Service Logging Options
Modify Web Service Logging Options


You can use any of the VBScript programs below in ActiveXperts Network Monitor. Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.



List All FTP Log Modules


Returns the names of all the FTP log modules on an IIS server.
strComputer = "."
Set objWMIService = GetObject _
    ("winmgmts:{authenticationLevel=pktPrivacy}\\" _
        & strComputer & "\root\microsoftiisv2")

Set colItems = objWMIService.ExecQuery _
    ("Select * from IIsFtpInfoSetting")
 
For Each objItem in colItems
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "Log Module List: " & objItem.LogModuleList
Next
	

List Custom Log Modules


Lists the names of all the custom log modules in an IIS server.
strComputer = "."
Set objWMIService = GetObject _
    ("winmgmts:{authenticationLevel=pktPrivacy}\\" _
        & strComputer & "\root\microsoftiisv2")

Set colItems = objWMIService.ExecQuery("Select * from IIsCustomLogModule")
 
For Each objItem in colItems
    Wscript.Echo "Name: " & objItem.Name
Next
	

List Custom Log Module Properties


Returns information about all the custom log modules on an IIS server.
strComputer = "."
Set objWMIService = GetObject _
    ("winmgmts:{authenticationLevel=pktPrivacy}\\" _
        & strComputer & "\root\microsoftiisv2")

Set colItems = objWMIService.ExecQuery _
    ("Select * from IIsCustomLogModuleSetting")

For Each objItem in colItems
    Wscript.Echo "Log Custom Property Data Type: " & _
        objItem.LogCustomPropertyDataType
    Wscript.Echo "Log Custom Property Header: " & _
        objItem.LogCustomPropertyHeader
    Wscript.Echo "Log Custom Property ID: " & _
        objItem.LogCustomPropertyID
    Wscript.Echo "Log Custom Property Mask: " & _
        objItem.LogCustomPropertyMask
    Wscript.Echo "Log Custom Property Name: " & _
        objItem.LogCustomPropertyName
    Wscript.Echo "Log Custom Property Node ID: " & _
        objItem.LogCustomPropertyNodeID
    For Each strProperty in objItem.LogCustomPropertyServicesString
        Wscript.Echo "Log Custom Property Services String: " & _
            strproperty
    Next
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "Setting ID: " & objItem.SettingID
Next
	

List IIsLogModulesSetting Instances


Demonstration script that lists all the instances of the IIsLogModulesSetting class.
strComputer = "."
Set objWMIService = GetObject _
    ("winmgmts:{authenticationLevel=pktPrivacy}\\" _
        & strComputer & "\root\microsoftiisv2")

Set colItems = objWMIService.ExecQuery _
    ("Select * from IIsLogModulesSetting")
 
For Each objItem in colItems
    Wscript.Echo "Name: " & objItem.Name
Next
	

List IIsLogModule Instances


Demonstration script that lists all the instances of the IIsLogModule class.
strComputer = "."
Set objWMIService = GetObject _
    ("winmgmts:{authenticationLevel=pktPrivacy}\\" _
        & strComputer & "\root\microsoftiisv2")

Set colItems = objWMIService.ExecQuery("Select * from IIsLogModule")
 
For Each objItem in colItems
    Wscript.Echo "Name: " & objItem.Name
Next
	

List Log Modules


Lists the names of all the log modules found on an IIS server.
strComputer = "."
Set objWMIService = GetObject _
    ("winmgmts:{authenticationLevel=pktPrivacy}\\" _
        & strComputer & "\root\microsoftiisv2")

Set colItems = objWMIService.ExecQuery("Select * from IIsLogModules")
 
For Each objItem in colItems
    Wscript.Echo "Name: " & objItem.Name
Next
	

List Log Module Settings


Returns information about all the log module settings on an IIS server.
strComputer = "."
Set objWMIService = GetObject _
    ("winmgmts:{authenticationLevel=pktPrivacy}\\" _
        & strComputer & "\root\microsoftiisv2")

Set colItems = objWMIService.ExecQuery _
    ("Select * from IIsLogModuleSetting")
 
For Each objItem in colItems
    Wscript.Echo "Log Module Id: " & objItem.LogModuleId
    Wscript.Echo "Log Module UI Id: " & objItem.LogModuleUiId
    Wscript.Echo "Name: " & objItem.Name
Next
	

List Web Service Logging Options


Returns information about Web service logging options on an IIS server.
strComputer = "."
Set objWMIService = GetObject _
    ("winmgmts:{authenticationLevel=pktPrivacy}\\" _
        & strComputer & "\root\microsoftiisv2")

Set colItems = objWMIService.ExecQuery _
    ("Select * from IIsWebServiceSetting")
For Each objItem in colItems
    Wscript.Echo "Log File Directory: " & objItem.LogFileDirectory
    Wscript.Echo "Log File Local Time Rollover: " & _
        objItem.LogFileLocaltimeRollover
    Wscript.Echo "Log File Period: " & objItem.LogFilePeriod
    Wscript.Echo "Log File Truncate Size: " & _
        objItem.LogFileTruncateSize
Next
	

Modify Web Service Logging Options


Demonstration script that modifies Web service logging options on an IIS server.
strComputer = "."
Set objWMIService = GetObject _
    ("winmgmts:{authenticationLevel=pktPrivacy}\\" _
        & strComputer & "\root\microsoftiisv2")

Set colItems = objWMIService.ExecQuery _
    ("Select * from IIsWebServiceSetting")

For Each objItem in colItems
    objItem.LogFileDirectory = "C:\Logs"
    objItem.LogFileLocaltimeRollover = True
    objItem.LogFilePeriod = 2
    objItem.LogFileTruncateSize = 1000000
    objItem.Put_
Next