Google+ Tools
Make Google+ profile picture
Make Google plus banners for profile
Create and share your Google Plus profile banners.

Profile image for mrk studios Rectifier on July 1, 2012

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.

Language
DOS Batch
Tags

Clear Windows 7 Event Log


@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. & echo. & echo.
echo Clearing event logs...
::Clear event logs by searching for them using a for loop
@for /f %%i in ( 'wevtutil el' ) do wevtutil cl "%%i" >NUL 2>&1
::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. & echo.
echo Batch finished!
ping 127.0.0.1 -n 3 | find "Reply" > nul

Comments

blog comments powered by Disqus