Jump to content

VB Script Problem


Der letzte Beitrag zu diesem Thema ist mehr als 180 Tage alt. Bitte erstelle einen neuen Beitrag zu Deiner Anfrage!

Empfohlene Beiträge

Geschrieben

Hallo, ich möchte in folgendes Script:

 

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:\app.evt")

If errBackupLog <> 0 Then

Wscript.Echo "The Application event log could not be backed up."

Else

objLogFile.ClearEventLog()

End If

Next

 

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _

& "{impersonationLevel=impersonate,(Backup)}!\\" & _

strComputer & "\root\cimv2")

 

Set colLogFiles = objWMIService.ExecQuery _

("Select * from Win32_NTEventLogFile where LogFileName='Security'")

 

For Each objLogfile in colLogFiles

errBackupLog = objLogFile.BackupEventLog("c:\Sec.evt")

If errBackupLog <> 0 Then

Wscript.Echo "The Application event log could not be backed up."

Else

objLogFile.ClearEventLog()

End If

Next

 

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _

& "{impersonationLevel=impersonate,(Backup)}!\\" & _

strComputer & "\root\cimv2")

 

Set colLogFiles = objWMIService.ExecQuery _

("Select * from Win32_NTEventLogFile where LogFileName='System'")

 

For Each objLogfile in colLogFiles

errBackupLog = objLogFile.BackupEventLog("c:\Sys.evt")

If errBackupLog <> 0 Then

Wscript.Echo "The Application event log could not be backed up."

Else

objLogFile.ClearEventLog()

End If

Next

 

den Aufruf einer REG Datei einbinden oder noch besser, den Inhalt der REG-Datei mit dem gleichen Script abarbeiten:

 

 

Windows Registry Editor Version 5.00

 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application]

"DisplayNameFile"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\

6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\

00,65,00,6c,00,73,00,2e,00,64,00,6c,00,6c,00,00,00

"DisplayNameID"=dword:00000100

"File"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,\

00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,63,00,\

6f,00,6e,00,66,00,69,00,67,00,5c,00,41,00,70,00,70,00,45,00,76,00,65,00,6e,\

00,74,00,2e,00,45,00,76,00,74,00,00,00

"MaxSize"=dword:00080000

"PrimaryModule"="Application"

"Retention"=dword:00000000

 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\System]

"DisplayNameFile"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\

6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\

00,65,00,6c,00,73,00,2e,00,64,00,6c,00,6c,00,00,00

"DisplayNameID"=dword:00000102

"File"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,\

00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,63,00,\

6f,00,6e,00,66,00,69,00,67,00,5c,00,53,00,79,00,73,00,45,00,76,00,65,00,6e,\

00,74,00,2e,00,45,00,76,00,74,00,00,00

"MaxSize"=dword:00080000

"PrimaryModule"="System"

"Retention"=dword:00000000

 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security]

"DisplayNameFile"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\

6f,00,74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\

00,65,00,6c,00,73,00,2e,00,64,00,6c,00,6c,00,00,00

"DisplayNameID"=dword:00000101

"File"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,\

00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,63,00,\

6f,00,6e,00,66,00,69,00,67,00,5c,00,53,00,65,00,63,00,45,00,76,00,65,00,6e,\

00,74,00,2e,00,45,00,76,00,74,00,00,00

"MaxSize"=dword:00080000

"PrimaryModule"="Security"

"Retention"=dword:00000000

 

thx

Der letzte Beitrag zu diesem Thema ist mehr als 180 Tage alt. Bitte erstelle einen neuen Beitrag zu Deiner Anfrage!

Erstelle ein Benutzerkonto oder melde dich an, um zu kommentieren

Du musst ein Benutzerkonto haben, um einen Kommentar verfassen zu können

Benutzerkonto erstellen

Neues Benutzerkonto für unsere Community erstellen. Es ist einfach!

Neues Benutzerkonto erstellen

Anmelden

Du hast bereits ein Benutzerkonto? Melde dich hier an.

Jetzt anmelden
×
×
  • Neu erstellen...