here is a batch file that will…
• Windows Update Reset
[ul]
[li]Stops Windows Update service (wuauserv)[/li][li]Stops Background Intelligent Transfer Service (BITS)[/li][li]Stops Cryptographic service[/li][li]Renames SoftwareDistribution folder to .old[/li][li]Renames catroot2 folder to .old[/li][li]Restarts all these services[/li][li]This clears Windows Update cache and fixes update issues[/li][/ul]
• Network Fixes
[ul]
[li]Flushes DNS cache[/li][li]Re-registers DNS[/li][li]Resets Winsock catalog (network configuration)[/li][li]Resets TCP/IP stack[/li][li]Fixes network connectivity issues[/li][/ul]
• System File Repairs
[ul]
[li]Runs System File Checker (sfc /scannow)[/li][li]Checks system files for corruption[/li][li]Runs DISM three-step repair:[/li][ol]
[li]CheckHealth: Basic health check[/li][li]ScanHealth: Deeper scan[/li][li]RestoreHealth: Attempts to fix found issues[/li][/ul]
[/ol]
• Event Log Management
[ul]
[li]Clears Application log[/li][li]Clears System log[/li][li]Clears Security log[/li][li]Gives clean slate for new events[/li][/ul]
• Disk Check
[ul]
[li]Runs chkdsk with /f (fix) and /scan parameters[/li][li]Checks disk for errors[/li][li]Schedules fixes for next restart[/li][/ul]
• Performance Optimization
[ul]
[li]Sets up Ryzen Balanced power plan[/li][li]Activates this power plan[/li][li]Disables automatic pagefile management[/li][li]Sets pagefile size to 32GB (optimized for your 32GB RAM)[/li][/ul]
• Logging
[ul]
[li]Creates log directory on Desktop[/li][li]Creates summary file of all actions[/li][li]Records timestamp of fixes[/li][/ul]
• Restart Option
[ul]
[li]Asks if you want to restart[/li][li]If yes, schedules restart in 10 seconds[/li][li]Restart recommended to apply all changes[/li][/ul]
Important Notes:
[ul]
[li]Will require restart to complete some fixes[/li][li]Some operations may take significant time (especially SFC and DISM)[/li][li]Backup important files before running[/li][li]All changes are logged in the created summary file[/li][/ul]
• Windows Update Reset
[ul]
[li]Stops Windows Update service (wuauserv)[/li][li]Stops Background Intelligent Transfer Service (BITS)[/li][li]Stops Cryptographic service[/li][li]Renames SoftwareDistribution folder to .old[/li][li]Renames catroot2 folder to .old[/li][li]Restarts all these services[/li][li]This clears Windows Update cache and fixes update issues[/li][/ul]
• Network Fixes
[ul]
[li]Flushes DNS cache[/li][li]Re-registers DNS[/li][li]Resets Winsock catalog (network configuration)[/li][li]Resets TCP/IP stack[/li][li]Fixes network connectivity issues[/li][/ul]
• System File Repairs
[ul]
[li]Runs System File Checker (sfc /scannow)[/li][li]Checks system files for corruption[/li][li]Runs DISM three-step repair:[/li][ol]
[li]CheckHealth: Basic health check[/li][li]ScanHealth: Deeper scan[/li][li]RestoreHealth: Attempts to fix found issues[/li][/ul]
[/ol]
• Event Log Management
[ul]
[li]Clears Application log[/li][li]Clears System log[/li][li]Clears Security log[/li][li]Gives clean slate for new events[/li][/ul]
• Disk Check
[ul]
[li]Runs chkdsk with /f (fix) and /scan parameters[/li][li]Checks disk for errors[/li][li]Schedules fixes for next restart[/li][/ul]
• Performance Optimization
[ul]
[li]Sets up Ryzen Balanced power plan[/li][li]Activates this power plan[/li][li]Disables automatic pagefile management[/li][li]Sets pagefile size to 32GB (optimized for your 32GB RAM)[/li][/ul]
• Logging
[ul]
[li]Creates log directory on Desktop[/li][li]Creates summary file of all actions[/li][li]Records timestamp of fixes[/li][/ul]
• Restart Option
[ul]
[li]Asks if you want to restart[/li][li]If yes, schedules restart in 10 seconds[/li][li]Restart recommended to apply all changes[/li][/ul]
Important Notes:
[ul]
[li]Will require restart to complete some fixes[/li][li]Some operations may take significant time (especially SFC and DISM)[/li][li]Backup important files before running[/li][li]All changes are logged in the created summary file[/li][/ul]
Code:
@echo off setlocal EnableDelayedExpansion title ROWAN_PC Event Log Issue Resolution net session >nul 2>&1 if %errorLevel% neq 0 (exit /b 1) set "LOG_DIR=%USERPROFILE%\Desktop\EventLog_Fixes_%date:~-4,4%%date:~-7,2%%date:~-10,2%" mkdir "%LOG_DIR%" 2>nul net stop wuauserv net stop bits net stop cryptsvc ren %systemroot%\SoftwareDistribution SoftwareDistribution.old ren %systemroot%\System32\catroot2 catroot2.old net start cryptsvc net start bits net start wuauserv ipconfig /flushdns ipconfig /registerdns netsh winsock reset netsh int ip reset sfc /scannow DISM /Online /Cleanup-Image /CheckHealth DISM /Online /Cleanup-Image /ScanHealth DISM /Online /Cleanup-Image /RestoreHealth for %%i in (Application System Security) do wevtutil cl %%i chkdsk C: /f /scan powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61 powercfg /setactive e9a42b02-d5df-448d-aa00-03f14749eb61 wmic computersystem where name="%computername%" set AutomaticManagedPagefile=False wmic pagefileset where name="C:\\pagefile.sys" set InitialSize=32768,MaximumSize=32768 echo ========================================================================> "%LOG_DIR%\Fix_Summary.txt" echo ROWAN_PC EVENT LOG FIXES SUMMARY - %date% %time%>> "%LOG_DIR%\Fix_Summary.txt" echo Fixes Applied:>> "%LOG_DIR%\Fix_Summary.txt" echo - Windows Update Reset>> "%LOG_DIR%\Fix_Summary.txt" echo - Network Stack Reset>> "%LOG_DIR%\Fix_Summary.txt" echo - System Files Checked>> "%LOG_DIR%\Fix_Summary.txt" echo - Event Logs Cleared>> "%LOG_DIR%\Fix_Summary.txt" echo - Disk Check Run>> "%LOG_DIR%\Fix_Summary.txt" echo - Power Plan Optimized>> "%LOG_DIR%\Fix_Summary.txt" echo - Pagefile Optimized>> "%LOG_DIR%\Fix_Summary.txt" echo Summary saved to: %LOG_DIR%\Fix_Summary.txt>> "%LOG_DIR%\Fix_Summary.txt" echo Restart now? (Y/N) set /p RESTART_CHOICE="> " if /i "%RESTART_CHOICE%"=="Y" shutdown /r /t 10 pause
Comment