Thoughts about IIS (and now SharePoint!)

IIS and SharePoint troubleshooting and Debugging

Script for enabling full IIS logging

Script for enabling full IIS logging

Rate This
  • Comments 4

Nothing overly fancy, but useful enough to warrant sharing.  This is something you can use to get your SharePoint farms set up to turn every IIS logging option on.  The good news is each web site in a MOSS farm shares the same web site ID, so it should be pretty easy to batch up:

Option Explicit

On Error Resume Next

 

Dim CmdLineArgs

Dim CurrSite

Dim CurrSiteObj

 

' Obtain all command line args

Set CmdLineArgs = WScript.Arguments.Named

 

' verify args

If (Not CmdLineArgs.Exists("SiteID")) Or _

   (Not CmdLineArgs.Exists("Server")) Then

Wscript.Echo "Error: Invalid number of command line arguments specified."

Wscript.Echo

Wscript.Echo "Usage:  ""cscript FullLogging.vbs /Server:<ServerName> /SiteID:<WebsiteID>"""

Wscript.Quit

End If

 

CurrSiteObj = "IIS://" & CmdLineArgs.Item("Server") & "/w3svc/" & CmdLineArgs.Item("SiteID")

Set CurrSite = GetObject(CurrSiteObj)

If Err.number <> 0 Then

        Wscript.Echo "Error querying IIS provider: " & CurrSiteObj

        Wscript.Echo "Error = " & Err.number & " - " & Err.Description

        WScript.Quit

End If

 

CurrSite.LogExtFileDate             = True

CurrSite.LogExtFileHost             = True

CurrSite.LogExtFileTime             = True

CurrSite.LogExtFileClientIp         = True

CurrSite.LogExtFileUserName         = True

CurrSite.LogExtFileSiteName         = True

CurrSite.LogExtFileComputerName     = True

CurrSite.LogExtFileServerIp         = True

CurrSite.LogExtFileMethod           = True

CurrSite.LogExtFileUriStem          = True

CurrSite.LogExtFileUriQuery         = True

CurrSite.LogExtFileHttpStatus       = True

CurrSite.LogExtFileWin32Status      = True

CurrSite.LogExtFileBytesSent        = True

CurrSite.LogExtFileBytesRecv        = True

CurrSite.LogExtFileTimeTaken        = True

CurrSite.LogExtFileServerPort       = True

CurrSite.LogExtFileUserAgent        = True

CurrSite.LogExtFileCookie           = True

CurrSite.LogExtFileReferer          = True

CurrSite.LogExtFileProtocolVersion  = True

CurrSite.LogExtFileHttpSubStatus    = True

CurrSite.SetInfo

 

wscript.echo "Done!"

Set CurrSite = Nothing

Set CmdLineArgs = Nothing

 

Have fun.

Edit:  If you want to trim the log size down, do not enable the Cookie field, since this can cause the logs to grow rather large over time:

CurrSite.LogExtFileCookie           = False

Thanks, Todd.

Page 1 of 1 (4 items)
Leave a Comment
  • Please add 8 and 1 and type the answer here:
  • Post