Delete all log files of windows (Server or Not)

There was a script wich i using it from a long time… today i figure out with PowerShell its litlle more easy then my oldskool command.


old one was

for /F "tokens=*" %1 in ('wevtutil.exe el') DO wevtutil.exe cl "%1"


new one.

wevtutil el | foreach { wevtutil cl $_ }


maybe it isnt too shot like one word but its more rememberable for me. in my old clear command  whenever i am need it,  its end with google 🙂  there was a lot of characters and i didnt like to keeo that kind of things in my mind.


but new one dosnt work with in classic Elevated Command Windows, its need Elevated Power shell Window.


if you put “start powershell ” in front of to our command then create new scheduled task to use login,  or logout  tasks with this exported task XML of windows. you will be able to do not do that querry again.


<Task xmlns="" version="1.2">
<RegistrationInfo> <Date>2016-11-09T14:28:55.2636</Date> <Author>centi\Administrator</Author> </RegistrationInfo>
<Principals><Principal id=”Author><UserId>centi\Administrator</UserId><LogonType>Password</LogonType><RunLevel>HighestAvailable</RunLevel
<Actions Context="Author">
<Command>Start powershell "wevtutil el | foreach { wevtutil cl $_ }" </Command>

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

This site uses Akismet to reduce spam. Learn how your comment data is processed.