/ Published in: DOS Batch
                    
                                        
This is a simple batch script to clear the event logs from a windows 7 or server 2008 machine. The script does *not* save these logs. This was tested on a local machine but could be adapted for remote use.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
@echo off
@cls
::Tested on a local machine using Windows 7 x64 Home Premium
::Use the ping command to wait -n # seconds; change # for time to wait
::Basic code can be found in various places on the internet
::Modified by Rectifier 06-30-2012
::If you receive an error try running the batch file as an administrator
::Note that the event log has to be enabled to begin with or this is a fairly useless batch
::Make readable prompt
echo Clearing event logs...
::Clear event logs by searching for them using a for loop
::Clear event logs not found by the for loop
wevtutil.exe cl "Microsoft-Windows-Diagnosis-DPS/Operational"
wevtutil.exe cl "Microsoft-Windows-User Profile Service/Operational"
wevtutil.exe cl "Microsoft-Windows-Windows Defender/Operational"
wevtutil.exe cl "Microsoft-Windows-Windows Defender/WHC"
wevtutil.exe cl "Microsoft-Windows-Windows Firewall With Advanced Security/Firewall"
wevtutil.exe cl System
::Informing the batch is finished executing
echo Batch finished!
Comments
 Subscribe to comments
                    Subscribe to comments
                
                