Solved

Security Log backup script

Posted on 2011-09-20
3
377 Views
Last Modified: 2012-06-27
Hello,

I just need a basic script where I can run so it will take my security logs and back them up to a shared so I don't have to manually back them up.

Thanks!
0
Comment
Question by:Sainai
  • 2
3 Comments
 
LVL 65

Accepted Solution

by:
RobSampson earned 250 total points
ID: 36571741
Hi, this VBS is from here:
http://msdn.microsoft.com/en-us/library/aa394593(VS.85).aspx

It will also clear the event log after backing it up.

Regards,

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

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

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

Open in new window

0
 

Author Comment

by:Sainai
ID: 36572083
Ahhhh RobSampson this is perfect! Thanks!
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 36572453
No problem. Glad to help.

Rob.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Server 2012 management. 5 34
Batch file or script with password 22 65
Writing lines of code from a form output in script within a results page 2 23
printf performancy 11 68
A short article about problems I had with the new location API and permissions in Marshmallow
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question