September 25, 2021

USEFUL-IT

A blog for USEFUL-IT information

Read EventLog Setting

vbscriptRead the eventlog settings by using the following script. 

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" & strComputer & "rootcimv2")
Set objInstalledLogFiles = objWMIService.ExecQuery _
("Select * from Win32_NTEventLogFile")
WScript.Echo "Name|MaxSize|Overwrite"
For each objLogfile in objInstalledLogFiles
If objLogfile.OverWriteOutdated > 365 Then
strOverwriteOutdated = "Never"
ElseIf objLogfile.OverWriteOutdated = 0 Then
strOverwriteOutdated = "As needed"
Else
strOverwriteOutdated = objLogfile.OverWriteOutdated & " days"
End If
Wscript.Echo objLogfile.LogFileName & "|" & objLogfile.MaxFileSize & "|" & strOverwriteOutdated
Next

022213_2242_Justatest1