Event Viewer One Click Clear

Page 2 of 11 FirstFirst 1234 ... LastLast

  1. Posts : 557
    Windows 7 x64 Ultimate SP1
    Thread Starter
       #10

    Someone seems to know code better than I do.
    Seems to work (I say that because I don't understand the code)

    Let's say you don't want to have to press exit key every time. We can modify this way


    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 goto theEnd
    :do_clear
    echo clearing %1
    wevtutil.exe cl %1
    goto :eof
    :noAdmin
    exit

    Download



    Nice. I'll try it a while and check. :)
    Event Viewer One Click Clear Attached Files
    Last edited by Zardoc; 27 Oct 2009 at 11:11.
      My Computer


  2. Posts : 1
    Windows 7
       #11

    I am logged in as administrator and I keep getting access is denied error when trying to clear out my event logs. Why?

    I have tried this script, the command prompt, the event viewer doesn't event have a clear function available. Can anyone help?
      My Computer


  3. Posts : 557
    Windows 7 x64 Ultimate SP1
    Thread Starter
       #12

    Hi and welcome to the forums.


    Even if you are logged in as administrator you must right click the command and choose run as administrator for it to work.
    Last edited by Zardoc; 09 Nov 2009 at 07:32.
      My Computer


  4. Posts : 9
    Windows 7 Ultimate
       #13

    Thanks..!
      My Computer


  5. Posts : 17,322
    Win 10 Pro x64
       #14

    Wow, Thank's Zardoc, That is a major timesaver!
      My Computer


  6. Posts : 557
    Windows 7 x64 Ultimate SP1
    Thread Starter
       #15

    Pleasure dude.

    Give rep if you like.
      My Computer


  7. Posts : 17,322
    Win 10 Pro x64
       #16

    Zardoc said:
    Pleasure dude.

    Give rep if you like.
    I Like, and I did + rep.
      My Computer


  8. Posts : 557
    Windows 7 x64 Ultimate SP1
    Thread Starter
       #17

    Thanks Derek.

    Happy you like it.
      My Computer


  9. Posts : 23
    Win7 x64
       #18

    lightningltd said:
    This is an even shorter script to clear the event logs and will cover new logs as well as the current ones (Don't remember who I got it from, but works fantastically):

    Attachment 33164
    OR you could also paste the following into a new batch file:

    @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

    This is way better than the first batch file that was posted!!!! Thanks lightningltd!!!
      My Computer


  10. Posts : 557
    Windows 7 x64 Ultimate SP1
    Thread Starter
       #19

    Thanks Randy, but if you read the whole post, I have a modified one in shorter than that and it does the same job.

      My Computer


 
Page 2 of 11 FirstFirst 1234 ... LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 15:27.
Find Us