backuplog.vbs strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate,(Backup)}!//" & _ strComputer &&nbs p;"/root/cimv2") ''获得 VMI对象 Set colLogFiles = objWMIService.ExecQuery _ ("Select * from Win32_NTEventLogFile where LogFileName=''Application''") ''获取日志对象中的应用程序日志 For Each objLogfile in colLogFiles errBackupLog = objLogFile.BackupEventLog("f:/application.evt") ''将日志备份为f:/application.evt If errBackupLog <> 0 Then Wscript.Echo "The Application event log could not be backed up." else Wscript.Echo "sUCcess backup log" End If Next
程序说明:假如备份成功将窗口提示:"success backup log" 否则提示:"The Application event log could not be backed up",此处备份的日志为application 备份位置为f:/application.evt,可以自行修改,此处备份的格式为evt的原始格式,用记事本打开则为乱码,这一点他不如dumpel用得方便。