Clear All Event Logs in Event Viewer in Windows  

Page 4 of 11 FirstFirst ... 23456 ... LastLast

  1. Posts : 512
    Windows 10 Version 1909 (Build 18363.815
       #30

    FWIW CCleaner will clear the Event Viewer Logs - just check the box under Windows>Advanced>Windows Events Logs. run CCleaner and it's that simple. Much faster than most ,bat files I've tried. Just a suggestion.
      My Computer


  2. Posts : 591
    Windows 10 Pro 64bit; Windows 10 TP; KDE Neon
       #31

    The only way to bring my Event Viewer to its purest state is the second option of this tutorial. CCleaner Pro does not clean it as thoroughly.

    Right after cleaning, before rebooting:

    Clear All Event Logs in Event Viewer in Windows-e.png


    Right after rebooting one time:

    Clear All Event Logs in Event Viewer in Windows-e1.png



    CCleaner Pro manages to reset my Reliability History, though, something I deeply appreciate! :)
      My Computers


  3. Posts : 512
    Windows 10 Version 1909 (Build 18363.815
       #32

    When using the batch file in Option 1, the process runs very fast in one pc , but very slow in the other. Previously, both ran very fast. What setting could I have messed up to slow down the speed of the batch file?
      My Computer


  4. Posts : 61,561
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #33

    Hello John, :)

    It can vary per system, but it could take a while if the PC is having issues or a large amount of events.
      My Computers


  5. Posts : 4
    Windows
       #34

    Is there any way to clear all OLD events from all event logs? I would like to clear everything more than (for example) 1 month old. Doable?
      My Computer


  6. Posts : 311
    Microsoft Windows 10 x64
       #35

    Excellent, it saves me a lot of time
    thank you

    Maybe "pure" Powershell syntax is

    Get-EventLog -LogName * | ForEach { Clear-EventLog $_.Log }
      My Computer


  7. Posts : 61,561
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #36

    D4ni3l said:
    Excellent, it saves me a lot of time
    thank you

    Maybe "pure" Powershell syntax is

    Get-EventLog -LogName * | ForEach { Clear-EventLog $_.Log }
    Thank you. Added. :)
      My Computers


  8. Posts : 10
    Windows 10
       #37

    Knowns methods can't clean my Microsoft-Windows-LiveId (and one or two log).
    Need to be manually all delete files in %windir%\System32\winevt\Logs\*.*
    I tried this commands as BAT file:

    @echo off

    net stop NcdAutoSetup
    net stop netprofm
    net stop NlaSvc
    net stop EventLog

    ping 1.1.1.1 -n 1 -w 1500 > nul

    del /f /q /a %windir%\System32\winevt\Logs\*.* > nul

    for /f %%a in ('WEVTUTIL EL') do WEVTUTIL CL "%%a" > nul

    net start NcdAutoSetup
    net start netprofm
    net start NlaSvc
    net start EventLog
      My Computer


  9. Posts : 61,561
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #38

    Hello pureocean, :)

    Did you use Option Two in an elevated command prompt?
      My Computers


  10. Posts : 228
    Win 10 Ver 1903
       #39

    I made a few modifications to pureocean's batch file to solve the required elevation and added a section to create a backup of the log files that are about to be deleted. It appears to work as it should.
    I included it below if anyone else wants it. The "batgotadmin" section is pretty widely used for this and always seems to work for me.

    Code:
    @echo off
    REM --> Check for permissions
    >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
    REM --> If error flag set, we do not have admin.
    if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
    ) else ( goto gotAdmin )
    :UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
    "%temp%\getadmin.vbs"
    exit /B
    :gotAdmin
    if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
    pushd "%CD%"
    CD /D "%~dp0"
    REM --> Create backup folder using date-time and copy all logs to folder.
    for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set datetime=%%I
    md c:\%datetime%-logs
    copy %windir%\System32\winevt\Logs\*.* c:\%datetime%-logs
    net stop NcdAutoSetup
    net stop netprofm
    net stop NlaSvc
    net stop EventLog
    ping 1.1.1.1 -n 1 -w 1500 > nul
    del /f /q /a %windir%\System32\winevt\Logs\*.* > nul
    for /f %%a in ('WEVTUTIL EL') do WEVTUTIL CL "%%a" > nul
    net start NcdAutoSetup
    net start netprofm
    net start NlaSvc
    net start EventLog
      My Computer


 

Tutorial Categories

Clear All Event Logs in Event Viewer in Windows Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


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

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




Windows 10 Forums