描述
备份和清除应用程序事件日志。
脚本代码
strComputer = "."
Set objWMIService =
GetObject("winmgmts:" _
& "{ impersonationLevel=impersonate,(Backup)
}!\\" & _
strComputer & "\root\cimv2")
Set colLogFiles =
objWMIService.ExecQuery _
("Select * from Win32_NTEventLogFile where
LogFileName='Application'")
For Each objLogfile in colLogFiles
errBackupLog = objLogFile.BackupEventLog("c:\scripts\application.evt")
If
errBackupLog <> 0 Then
Wscript.Echo "The Application
event log could not be backed up."
Else
objLogFile.ClearEventLog()
End If
Next
本文转自 苏繁 51CTO博客,原文链接:http://blog.51cto.com/goxia/221141,如需转载请自行联系原作者