Tech Off Post

Single Post Permalink

View Thread: vista's event viewer - I don't like it
  • User profile image

    Okay I have worked hard and written my own solution-- yes its written in good old-fashioned BATCH file format.  Hey, it works!  And this doesnt require any powershell install or any 3rd party tools.  I answered my own question, which is always the best!! Wink

    I am going to share this with the community in case anyone else (I am sure there are) needs it:

    @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 Event Logs have been cleared! ^<press any key^>
    goto theEnd
    echo clearing %1
    wevtutil.exe cl %1
    goto :eof
    echo You must run this script as an Administrator!
    echo ^<press any key^>