A lightweight, transparent PowerShell alternative to bloated system optimization software. Designed for system administrators and power users who prefer clean code over commercial "tune-up" utilities.
This script automates deep system maintenance using native Windows APIs and binaries. It provides real-time, per-category space tracking so you can see exactly where the junk was hiding — not just a single number at the end.
By using this script, you eliminate the need for third-party software such as:
- CCleaner / BleachBit: Handles temporary files, caches, and system junk.
- Wise Disk Cleaner: Automates Windows Update cleanup and storage optimization.
- Network Reset Utilities: Replaces manual flushing of DNS and resetting of the network stack.
- Manual System Maintenance: Integrates SFC and DISM repair cycles into a single workflow.
- Per-Category Space Tracking: Freed megabytes are measured and reported for every individual cleanup step, not just a total at the end.
- System Repair: Automates
sfc /scannowandDISM RestoreHealthfor OS integrity checks. - Advanced Cache Removal: Clears Windows Update Distribution, Prefetch, Thumbnail, and IE/Edge Legacy caches.
- Network Optimization: Flushes DNS and resets Winsock/TCP stacks.
- Structured Output: Color-coded console output — green for freed space, gray for skipped steps.
- Open PowerShell as Administrator (
Win + X→ Terminal/PowerShell as Administrator). - Run the script:
.\windows_cleaner.ps1 - Restart your computer to finalize network and system repairs.
Note — cleanmgr: The
cleanmgr /sagerun:1step requires a one-time manual configuration. Runcleanmgr /sageset:1first to select which categories Disk Cleanup should handle. Without this, the step will silently do nothing.
FOR ADVANCED USERS ONLY. This script performs aggressive system operations:
- DISM RestoreHealth: This is the slowest step and can take 10–30 minutes with no visible progress (output is suppressed). The process is working as long as
DISM.exeandDismhost.exeappear in Task Manager — low CPU and RAM usage is completely normal. Do not cancel it. If you don't need system repair, comment out the relevant lines:# DISM /Online /Cleanup-Image /RestoreHealth | Out-Null # sfc /scannow | Out-Null
- Event Logs: Clears all logs — may hinder troubleshooting of recent system errors.
- Network Reset: Drops active connections immediately; reboot required afterward.
- Update Rollbacks: Cleaning SoftwareDistribution may prevent uninstallation of recently applied Windows Updates.
- ResetBase: The
/ResetBaseflag is intentionally commented out. It permanently removes all Update rollback points — only uncomment if you know what you're doing.
(now public for all)
- Per-category space tracking via
Run-Stephelper function — each cleanup stage now reports freed MB individually. - Deprecated API replaced:
Get-EventLog(removed in PS 7+) replaced withGet-WinEvent+EventLogSession.GlobalSession.ClearLog(). - DISM/SFC excluded from space tracking — runtime too long for a meaningful before/after delta; reported separately.
- DISM warning added — clarifies that near-zero CPU/RAM during RestoreHealth is normal; process downloads repair files from Microsoft servers.
/ResetBasecommented out by default — was previously active, now opt-in with explicit warning.netshcommands split to separate lines — avoids edge-case failures when chained with semicolons in certain PS versions.#Requires -RunAsAdministratoradded — script exits immediately with a clear error if not run as Admin.- Translated to English for community release.
- Structured, color-coded console output (green / gray / yellow sections).
(was Privat)
- Initial release.
- Single total space delta (before/after entire script).
- Combined PowerShell cmdlets and CMD binaries in one block.
- German language.
Developed by Volkan — No Ads. No Telemetry. No Bullshit.
Readme.md fixed & translated with help of AI