
February 22nd, 2012, 07:36 PM
|
|
Contributing User
|
|
Join Date: Apr 2011
Posts: 128
Time spent in forums: 1 Day 2 h 27 m 54 sec
Reputation Power: 3
|
|
|
Event log backup
Hi,
I need a script to do event log backup, system event log only.
I found this script online but when I run it the system.evt file is much smaller than the file I collect manually.
Could you guys help me with this?
Thanks, vl123456
Code:
dtmThisDay = Day(Date)
dtmThisMonth = Month(Date)
dtmThisYear = Year(Date)
strBackupName = dtmThisYear & "_" & dtmThisMonth & "_" & dtmThisDay
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
objLogFile.BackupEventLog("c:\scripts\" & strBackupName & _
"_system.evt")
Next
|