serverguy78
MIS
Hello, I'm trying create an event log script that will let me set the maximum log size. Here is what I have so far and I'm getting errors when I try to run it. Please assist
Code:
strComputer = "."
Set objWMIService = GetObject("winmgmts:"
& "{impersonationLevel=impersonate,(Security)}!\\" &
strComputer & "\root\cimv2")
Set colLogFiles = objWMIService.ExecQuery
("Select * from Win32_NTEventLogFile")
For each objLogfile in colLogFiles
strLogFileName = objLogfile.Name
Set wmiSWbemObject = GetObject
("winmgmts:{impersonationLevel=Impersonate}!\\.\root\cimv2:"
& "Win32_NTEventlogFile.Name=''" & strLogFileName & "''")
wmiSWbemObject.MaxFileSize = 2500000000
wmiSWbemObject.OverwriteOutdated = 14
wmiSWbemObject.Put
Next