Bueno pues ahí va la primera aportación un poco rollo a este rollo de blog.
Este script hecho en Vbs lo que hace es borrar ficheros de una carpeta y dejar un log para que sepamos lo que se ha borrado.
option explicit
BorraEvtx "C:\windows\System32\winevt\logs", "Archive-Security"
sub BorraEvtx (rep, inicioFic)
Dim fso,files, fld, f1, regx, NewFile,log
set fso=wscript.createobject("scripting.filesystemobject")
set fld=fso.getfolder(rep)
set files=fld.files
set regx =new regexp log = "c:\Bull\BorradoEvtx.log"
with regx
.ignorecase = true
.Global=true
.Pattern = "\b" & InicioFic & "{1}"
End With
'Creamos un fichero de log si no existe y si ya existe simplemente lo abrimos para añadir líneas.
If fso.fileexists (log)
then set NewFile =fso.opentextfile(log,8,true)
else
set NewFile =fso.CreateTextFile(log)
End if
For Each f1 in files
if regx.test (f1.name) then
NewFile.WriteLine(f1.name & " Borrado el dia " & Date() & " a las " & Time() )
f1.delete
End if
Next
End sub
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario