Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Security Log backup script

Posted on 2011-09-20
3
Medium Priority
?
388 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 1000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Make the most of your online learning experience.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Starting up a Project

971 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