Clear all eventlogs with one simple command

When creating a base image within an environment provisioned with Citrix Provisioning Server, it is desired to clear all Windows event logs when you create your base image so that your image is as clean as possible.

One way of doing this is by using the GUI… now this will take a lot of time and it’s not something you would want to do weekly.

There must be a way to do this easier, right?
That’s correct, you can clean all Windows event logs with one simple command:

for /F “tokens=*” %1 in (‘wevtutil.exe el’) DO (wevtutil.exe cl “%1”)

And for those of you that would like to use a PowerShell command:

get-eventlog -list |%{$_.clear()}

Leave a Reply

Your email address will not be published. Required fields are marked *