Script to backup log files
hello,
i looking script backup system, app , security log files network computername, time , date stamp on file if successful clear log files. have checked around internet , have not found looking for.
thanks help,
tom
hello,
this way security log safed , cleared , stored like, in example here on d:\ drive
;the account runs scheduled task, needs user rights assignment: backup files , directorys, logon batch job, generate security audits, manage auditing , security log
;save file .vbs
strdate = year(now) & "-" & right("0" & month(now),2) & "-" & right("0" & day(now),2) & "-"
strcomputer = "."
set objwmiservice = getobject("winmgmts:" _
& "{impersonationlevel=impersonate,(backup,security)}!\\" & _
strcomputer & "\root\cimv2")
set collogfiles = objwmiservice.execquery _
("select * win32_nteventlogfile logfilename='security'")
each objlogfile in collogfiles
errbackuplog = objlogfile.backupeventlog("d:\securitylog\"& strdate &"security.evt")
if errbackuplog <> 0 then
wscript.echo "the security event log not backed up."
else
objlogfile.cleareventlog()
end if
next
best regards meinolf weber disclaimer: posting provided "as is" no warranties or guarantees , , confers no rights.
Windows Server > Windows Server General Forum
Comments
Post a Comment