Event logs are records of significant events that happen on your Windows Server system, such as application crashes, security breaches, or system updates. They can be useful for troubleshooting or auditing purposes, but they can also take up a lot of disk space and clutter your system. If you want to clear all the event logs on your Windows system, you can use a simple PowerShell command that does the job in one go.

The PowerShell Command

The PowerShell command that clears all the event logs on a Windows system is:

Wevtutil el | Foreach-Object {wevtutil cl “$_”}

This command consists of two parts, separated by a pipe symbol (|). The first part, Wevtutil el, lists all of the event logs on the system. The second part, Foreach-Object {wevtutil cl “$_”}, clears each log one by one. The “$_” is a placeholder that represents the current log name in the loop.

How to Run the Command

To run the command, you need to open PowerShell as an administrator. To do that, follow these steps:

  • Press the Windows key or click the Start button.
  • Type PowerShell in the search box.
  • Right-click on the PowerShell app and select Run as administrator.
  • Click Yes on the User Account Control prompt.

Once you have PowerShell open, you can copy and paste the command and press Enter. The command will run and clear all the event logs on your system. You will see a list of the log names as they are cleared. The process may take a few minutes, depending on how many logs you have and how large they are.

itconsultant Previous post What is an IT consultant?
Next post How to Monitor and Report on Intune Performance and Usage