Solution Definition
How to clear Windows Eventlogs from Powershell? That question I had solved with my previous post but now I have ported the script into Powershell. During my Windows 7 development of a WIM image I wanted to clear the logs after the image was restored. I am using several PowerShell scripts and adding this command line helped me to have a clean start of logs.
Requirements
- Make sure you open a PowerShell with Windows 7 elevated privileges
- Create a ps1 file based on the script below.
Script
$logs = wevtutil el $logs | foreach-object {invoke-expression -command "wevtutil cl '$_'"}
Leave a comment