Back Up and Clear an Event Log - Forum

Forum Navigation
You need to log in to create posts and topics.

Back Up and Clear an Event Log

Tengo un problema  con este vbs es para salvar los log del sistema pero todos funcionan menos Setup (Instalaciones). La img muestra como está quedando mi programa.

' Back Up and Clear an Event Log


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate,(Backup)}!\\" & _
        strComputer & "\root\cimv2")

Set colLogFiles = objWMIService.ExecQuery _
    ("Select * from Win32_NTEventLogFile where LogFileName='Setup'")

For Each objLogfile in colLogFiles
    errBackupLog = objLogFile.BackupEventLog("c:\scripts\Setup.evt")
    If errBackupLog <> 0 Then        
        Wscript.Echo "The Application event log could not be backed up."
    Else
        objLogFile.ClearEventLog()
    End If
Next

 

 

Uploaded files:
  • You need to login to have access to uploads.

Este es mi programa ya terminado el mismo permite salvar los logs del sistema, espero que les sea útil y que reporten los errores para corregirlos.

Use programador de tareas para salvar todos los logs de forma automática (taskschd.msc) usando el parámetro -a

Ejemplo: C:\BackUpLog\BackUpLogs.exe –a

 

Uploaded files:
  • You need to login to have access to uploads.