Login :: Register
General Topics
HostedbyMaximumASP170x35
2005 IIS MVPs
Other IIS Sites
  How can I set the Log File Directory? 

The following script will allow you to set the LogFileDirectory for a specific Web Site. The script currently is set to apply this change to the Default Web Site - Web Site Instance ID 1
Dim ServerObj, LogFileDirectory, Path, ServerName, WebSiteID
on error resume next
ServerName = "Localhost"
WebSiteID = 1
WebPath = "IIS://" & ServerName & "/W3SVC/" & WebSiteID
LogFiledirectory = "C:\Temp"
Set ServerObj = GetObject(WebPath )
if (Err <> 0) then
 WScript.Echo "Unable to read the " & WebPath & " IIS object"
 WScript.Quit(1)
end if
ServerObj.LogFileDirectory = LogfileDirectory
ServerObj.SetInfo
if (Err <> 0) then
 WScript.Echo "Unable to set the Log File Directory: Err=" & Err.Description & " (" & Err & ")"
else
 WScript.Echo "LogFileDirectory set to " & LogFileDirectory & " for " & WebPath 
end if
 This site and its contents are Copyright 1999-2004 by IISFAQ Microsoft Corporation in no way endorses or is affiliated with IISFAQ