One command to update, clean, and optimize Windows 11 - safely.
Quick Start β’ Features β’ Parameters β’ Safety β’ Docs β’ FAQ
WinClean is a free, open-source Windows 11 cleanup and maintenance script written in PowerShell. In one command it installs Windows and app updates, frees disk space by clearing temporary files and browser caches, cleans developer caches (npm, pip, NuGet, Docker, WSL, IDEs), and runs a deep system cleanup - all with a restore point, protected system paths, and a preview mode so nothing important is touched.
π‘ Typical result: 5-20 GB freed, depending on how the system is used.
Requirements: PowerShell 7.1+ (
winget install Microsoft.PowerShell) and an elevated terminal (Win+X -> Terminal (Admin)).
See what it would do first (a read-only preview):
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/bivlked/WinClean/main/get.ps1))) -ReportOnlyRun it once (updates + cleanup):
irm https://raw.githubusercontent.com/bivlked/WinClean/main/get.ps1 | iexInstall (or update) + create a desktop shortcut that always runs elevated:
irm https://raw.githubusercontent.com/bivlked/WinClean/main/install.ps1 | iex
|
π₯ Alternative installation methods
Install-Script -Name WinClean -Scope CurrentUserThen run as Administrator:
WinClean.ps1Invoke-WebRequest -Uri "https://raw.githubusercontent.com/bivlked/WinClean/main/WinClean.ps1" -OutFile "WinClean.ps1"
.\WinClean.ps1git clone https://github.com/bivlked/WinClean.git
cd WinClean
.\WinClean.ps1Update the copy you actually run, with the method you installed it with:
| Installed with | Update with |
|---|---|
install.ps1 (desktop shortcut) |
re-run irm https://raw.githubusercontent.com/bivlked/WinClean/main/install.ps1 | iex from an elevated terminal |
get.ps1 one-liner |
nothing to do - every run downloads the latest release |
PowerShell Gallery (Install-Script) |
Update-Script -Name WinClean |
PowerShell Gallery (Install-PSResource) |
Update-PSResource -Name WinClean |
| Manual download or clone | download the latest release again |
When a newer version exists, WinClean names the option that applies to the copy you
launched (the check runs at startup unless -SkipUpdates is passed, and says nothing when
you are already up to date). Only a copy installed from the Gallery can update itself; the others cannot,
and are told what to do instead rather than being offered an update that would leave the
running file untouched.
|
|
|
|
|
|
|
|
Browsers: Edge, Chrome, Brave, Yandex, Opera, Opera GX, and Firefox. Every profile is cleaned for Chrome, Edge, and Firefox; the default profile for the rest. Bookmarks, passwords, and history are never touched. Full inventory: docs/what-is-cleaned.md.
| Parameter | Description | Default |
|---|---|---|
-SkipUpdates |
Skip Windows and winget updates | false |
-SkipCleanup |
Skip all cleanup (system, deep, developer, Docker/WSL, Visual Studio) | false |
-SkipRestore |
Skip system restore point creation | false |
-SkipDevCleanup |
Skip developer caches (npm, pip, etc.) | false |
-SkipDockerCleanup |
Skip Docker/WSL cleanup | false |
-SkipVSCleanup |
Skip Visual Studio cleanup | false |
-SkipDiskCleanup |
Skip only the Storage Sense / Disk Cleanup step, which can be the slowest | false |
-DisableTelemetry |
Disable Windows telemetry via Group Policy | false |
-ReportOnly |
Dry run - show what would be done | false |
-LogPath |
Custom log file path | Auto |
-ResultJsonPath |
Write a machine-readable run summary (JSON) for automation/CI | Off |
-SkipCleanupturns off the whole cleanup group. Use the per-category flags (-SkipDevCleanup,-SkipDockerCleanup,-SkipVSCleanup) for finer control when you still want the system cleanup. The-ResultJsonPathschema is documented in docs/result-json.md.
| Profile | Command | Best For |
|---|---|---|
| Preview | .\WinClean.ps1 -ReportOnly |
First run - see what will be cleaned without changes |
| Safe | .\WinClean.ps1 -SkipUpdates -SkipDockerCleanup |
Minimal risk - only temp files and caches |
| Developer | .\WinClean.ps1 |
Full cleanup - includes npm, pip, nuget, Docker, IDE caches |
| Quick | .\WinClean.ps1 -SkipUpdates -SkipDevCleanup -SkipVSCleanup |
Fast - system cleanup only, no dev tools |
| Updates Only | .\WinClean.ps1 -SkipCleanup |
Just Windows and app updates, no cleanup at all |
π‘ Tip: Always run with
-ReportOnlyfirst to preview what will be cleaned.
| Requirement | Version | Notes |
|---|---|---|
| Windows | 11 | Tested on 23H2/24H2/25H2 (most features also work on Windows 10) |
| PowerShell | 7.1+ | Download here |
| Rights | Administrator | Required for system operations |
π¦ Optional dependencies
| Component | Required For | Auto-installed |
|---|---|---|
| PSWindowsUpdate | Windows updates | β Yes |
| winget | App updates | β Manual |
| Docker Desktop | Docker cleanup | β Manual |
| WSL 2 | WSL optimization | β Manual |
WinClean is built to be safe to run on a working machine. The short version:
| Safety Feature | Description |
|---|---|
| π Restore Point | Attempted before the maintenance phases; a failure is warned and does not stop the run (skip with -SkipRestore) |
| π‘οΈ Protected Paths | C:\Windows, C:\Program Files, C:\Users and volume roots are never deleted |
| π¦ Preserves Packages | node_modules, .nuget\packages, virtualenvs, vendor are kept |
| ποΈ Preview Mode | -ReportOnly shows changes first |
| π Fail-closed Install | One-liners verify SHA256 against the release asset |
| π§ͺ VM-verified | Every release is run end-to-end on real Windows 11 VMs (ru-RU and en-US) |
β Cleaned vs π‘οΈ Preserved
| β Cleaned | π‘οΈ Preserved |
|---|---|
%TEMP%\* |
Documents, Downloads |
| Browser caches | Browser bookmarks, passwords |
npm-cache |
node_modules |
pip\Cache |
Virtual environments |
Composer\cache |
vendor |
NuGet\v3-cache |
\.nuget\packages |
\.gradle\build-cache |
\.gradle\caches\modules |
Full trust and safety model, including Controlled Folder Access and the bootstrap verification: docs/safety.md.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β WinClean v2.22 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β PREPARATION β
β ββ β Check Administrator Rights β
β ββ β Check Pending Reboot β
β ββ β Create System Restore Point β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β UPDATES β
β ββ π Windows Updates (including drivers) β
β ββ π Winget Application Updates β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β CLEANUP β
β ββ ποΈ Temporary Files & Browser Caches β
β ββ ποΈ Developer Caches (npm, pip, nuget, gradle) β
β ββ π³ Docker & WSL Optimization β
β ββ π οΈ Visual Studio & IDE Caches β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β DEEP CLEANUP β
β ββ π§ DISM Component Cleanup β
β ββ πΎ Storage Sense, then Disk Cleanup unless it proved β
β β it worked (up to 23 handlers) β
β ββ π Driver Store (superseded packages) β
β ββ π§Ή Stale Kernel Dumps (older than 30 days) β
β ββ π Windows.old Removal (prompted; 15s default = yes) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β PRIVACY (optional) β
β ββ π Clear DNS Cache & History β
β ββ βοΈ Disable Telemetry (if -DisableTelemetry) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β π DISK SPACE REPORT + SUMMARY β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Each phase's dispatch status is recorded in the result JSON as completed, skipped, or failed (invoked / suppressed by a flag / threw), so an automated run can tell "everything ran" from "a phase threw". See docs/result-json.md.
Every run writes a detailed log to %TEMP%\WinClean_<date>.log with a timestamp, status (success / warning / error), freed space per category, and total time. Pass -ResultJsonPath for a machine-readable summary.
Deep-dive documentation lives in docs/:
| Page | What's inside |
|---|---|
| Safety model | Restore points, protected paths, fail-closed bootstrap, Controlled Folder Access |
| What is cleaned | Exhaustive per-phase inventory: cleaned vs preserved |
| Result JSON | -ResultJsonPath schema for automation and CI |
| Troubleshooting | Common problems and fixes |
| FAQ | Extended questions and answers |
| Comparison | How WinClean compares to manual cleanup |
| Release process | How releases are built and verified |
Is it safe to run WinClean?
Yes. WinClean attempts a system restore point before the maintenance phases (and continues with a warning if it cannot create one), and it never bulk-deletes protected system roots like C:\Windows or C:\Program Files. Use -ReportOnly to preview first. More: docs/safety.md.
Will it delete my installed programs or packages?
No. WinClean only cleans caches and temporary files. Installed programs, npm/NuGet packages, and user data remain untouched.
How often should I run it?
Monthly is a good default. Heavy developers or users with limited disk space may benefit from weekly runs.
Can I run it on Windows 10?
It is designed for Windows 11, but most features work on Windows 10 with PowerShell 7.1+.
More questions are answered in docs/faq.md and docs/troubleshooting.md.
Contributions are welcome. See CONTRIBUTING.md for the workflow, code style, and testing, and open a Discussion for questions, ideas, or to share a success story.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'feat: add some amazing feature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Report Bug β’ Request Feature β’ Discussions β’ Changelog
Made with β€οΈ for Windows users