New
#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.
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.
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:
Right after rebooting one time:
CCleaner Pro manages to reset my Reliability History, though, something I deeply appreciate! :)
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?
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.
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?
Excellent, it saves me a lot of time
thank you
Maybe "pure" Powershell syntax is
Get-EventLog -LogName * | ForEach { Clear-EventLog $_.Log }
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
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