Set maximum size of an Event Log (VBScript)
This code can be found in
Chapter 16 of Windows XP Cookbook
Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.
Find out how to download all of the VBScript code from this site.
' From the book "Windows XP Cookbook"
' ISBN: 0596007256
' ------ SCRIPT CONFIGURATION ------
strLog = "<LogName>" ' e.g. Application
intSizeBytes = <SizeInBytes> ' e.g. 1024 * 512 (512KB)
strComputer = "<ComputerName>" ' e.g. wks01 (use "." for local machine)
' ------ END CONFIGURATION ---------
set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set colLogs = objWMI.ExecQuery("Select * from Win32_NTEventlogFile Where " & _
"Logfilename = '" & strLog & "'")
if colLogs.Count <> 1 then
WScript.Echo "Fatal error. Number of logs found: " & colLogs.Count
WScript.Quit
end if
for each objLog in colLogs
objLog.MaxFileSize = intSizeBytes
objLog.Put_
WScript.Echo strLog & " max size set to " & intSizeBytes
next
|
This code has been viewed 1466 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|