Solved

Security Log backup script

Posted on 2011-09-20
3
380 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Suggested Solutions

Title # Comments Views Activity
Calculate age in Microsoft Word 10 71
vb6 Where condition on dbo 2 31
Modify Text File with Excel Macro 13 51
78 files, need to delete row 2 in every file 3 34
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

710 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