Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Security Log backup script

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Six Sigma Control Plans
Starting up a Project

722 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