You can use this script:
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='Security'")
For Each objLogfile in colLogFiles
objLogFile.BackupEventLog("\\ServerName\ShareName\" & strBackupName & _
"_security.evt")
objLogFile.ClearEventLog()
Next
Set colLogFiles = objWMIService.ExecQuery _
("Select * from Win32_NTEventLogFile where LogFileName='Application'")
For Each objLogfile in colLogFiles
objLogFile.BackupEventLog("\\ServerName\ShareName\" & strBackupName & _
"_application.evt")
objLogFile.ClearEventLog()
Next
Set colLogFiles = objWMIService.ExecQuery _
("Select * from Win32_NTEventLogFile where LogFileName='System'")
For Each objLogfile in colLogFiles
objLogFile.BackupEventLog("\\ServerName\ShareName\" & strBackupName & _
"_system.evt")
objLogFile.ClearEventLog()
Next
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36:





by: gamma1983Posted on 2009-08-04 at 01:25:30ID: 25011506
http://www.vistax64.com/po wershell/1 47183-usin g-powershe ll- handle- eventlog.h tml