Solved

Security Log backup script

Posted on 2011-09-20
3
364 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

A short article about a problem I had getting the GPS LocationListener working.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
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 …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

708 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now