Submitted By: Dave Wright

Enables/disables the extended logging options for the W3C Extended Log File Format provider.

Visual Basic
Edit|Remove
'==========================================================================
' Title: SetIISExtLog.vbs
' Author: Dave Wright (01-29-2006)
'==========================================================================

' USAGE:  cscript SetIISExtLog.vbs

' NOTES:  Turns on of off True|False value for each log Option
' NOTES:  Replace ServerName and SiteIndex with real values
' NOTES:  Replace each True|False with appropriate value

' Setup variables
Dim ServerName as String
Dim SiteIndex as Long
Dim ADSIref as String

' Define some starting values
ServerName = "WEB_SERVER"
SiteIndex = "SITE_INDEX"
ADSIref = "IIS://" & ServerName & "/W3SVC/" & SiteIndex

' Call ADSI interface to set the target server/Site
Set Site = GetObject(ADSIref)

' Enable|Disable the log settings (currently turns everything on)
WScript.Echo "Setting log properties for server: " & ServerName
WScript.Echo "Setting log properties for site: " & SiteIndex
Site.LogExtFileDate = True
Site.LogExtFileTime = True
Site.LogExtFileClientIp = True
Site.LogExtFileUserName = True
Site.LogExtFileSiteName = True
Site.LogExtFileComputerName = True
Site.LogExtFileServerIp = True
Site.LogExtFileServerPort = True
Site.LogExtFileMethod = True
Site.LogExtFileUriStem = True
Site.LogExtFileUriQuery = True
Site.LogExtFileHttpStatus = True
Site.LogExtFileWin32Status = True
Site.LogExtFileBytesSent = True
Site.LogExtFileBytesRecv = True
Site.LogExtFileTimeTaken = True
Site.LogExtFileProtocolVersion = True
Site.LogExtFileUserAgent = True
Site.LogExtFileCookie = True
Site.LogExtFileUserAgent = True
Site.LogExtFileReferer = True

' Call SetInfo method to force changes
Site.SetInfo
WScript.Echo "Log properties set."