
Quote: Originally Posted by
ColTom2
Hi:
Does anyone know how to clear the Administrative Events log listed under Custom Views in the Event Viewer?
All the logs listed under the Windows logs have options to clear, but the above does not.
Thanks,
ColTom2
I've tried this and it works to do what you are asking. Save the code as .bat and run it. I'll try and search for the source and post back with it.
Code:
@echo off
FOR /F "tokens=1,2*" %%V IN ('bcdedit') DO SET adminTest=%%V
IF (%adminTest%)==(Access) goto noAdmin
for /F "tokens=*" %%G in ('wevtutil.exe el') DO (call :do_clear "%%G")
echo.
echo Event Logs have been cleared! ^<press any key^>
goto theEnd
:do_clear
echo clearing %1
wevtutil.exe cl %1
goto :eof
:noAdmin
echo You must run this script as an Administrator!
echo ^<press any key^>
:theEnd
pause>NUL