Script backup log windows server 2003

Discussion in 'Scripting' started by carlo76, Oct 5, 2009.

  1. carlo76

    carlo76 Guest

    Buongiorno,
    in base alle ultime misure del garante in materia di protezione di dati
    personali (registrazione degli accessi per un congruo periodo non inferiore
    a 6 mesi), ho necessità di schedulare un backup del log eventi security di
    un server (controller di dominio) con windows server 2003 !.
    Come posso procedere o secondo Voi qual'è la strada giusta per questo tipo
    di operazione ?
    Grazie e saluti.
     
    carlo76, Oct 5, 2009
    #1
    1. Advertisements

  2. Here you go:

    '---------------------------------
    'Back up the Security event logger
    'http://www.microsoft.com/technet/scriptcenter/guide/sas_log_hdyb.mspx?mfr=true
    '17.9.2009 FNL
    '---------------------------------
    sLog = "c:\Security.evt"
    Set oWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate,(Backup, Security)}!" & _
    "\\.\root\cimv2")
    Set cLogFiles = oWMIService.ExecQuery _
    ("Select * from Win32_NTEventLogFile where LogFileName='Security'")

    Set oFSO = CreateObject("Scripting.FileSystemObject")
    If oFSO.FileExists(sLog) then oFSO.DeleteFile(sLog)
    For Each oLogfile In cLogFiles
    If oLogfile.BackupEventLog(sLog) <> 0 _
    Then MsgBox "Could not back up the " & sBranch & " Event Log."
    Next

    Note also that this is an English-speaking newsgroup. Since not many of the
    potential respondents speak Italian, you might get more replies if you
    posted in English or if you selected an Italian-speaking newsgroup for your
    posts.
     
    Pegasus [MVP], Oct 5, 2009
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.