Automated system maintenance: updates, cleanup, and optimization in one script
Why WinClean? β’ Features β’ Quick Start β’ Parameters β’ Safety β’ FAQ
|
|
π‘ Average cleanup result: 5-20 GB freed, depending on system usage
|
|
|
|
|
|
Install-Script -Name WinClean -Scope CurrentUserThen run as Administrator:
WinClean.ps1π₯ Alternative installation methods
irm https://raw.githubusercontent.com/bivlked/WinClean/main/WinClean.ps1 -OutFile "$env:TEMP\WinClean.ps1"; Start-Process pwsh -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$env:TEMP\WinClean.ps1`""# Download
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/bivlked/WinClean/main/WinClean.ps1" -OutFile "WinClean.ps1"
# Run as Administrator
.\WinClean.ps1git clone https://github.com/bivlked/WinClean.git
cd WinClean
.\WinClean.ps1| Parameter | Description | Default |
|---|---|---|
-SkipUpdates |
Skip Windows and winget updates | false |
-SkipCleanup |
Skip all cleanup operations | 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 |
-DisableTelemetry |
Disable Windows telemetry via Group Policy | false |
-ReportOnly |
Dry run β show what would be done | false |
-LogPath |
Custom log file path | Auto |
.\WinClean.ps1All updates + all cleanup |
.\WinClean.ps1 -SkipUpdatesNo updates, just cleanup |
.\WinClean.ps1 -ReportOnlySee what would happen |
.\WinClean.ps1 -SkipUpdates -SkipDockerCleanupFast cleanup only |
Choose the right profile for your needs:
| 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 |
π‘ Tip: Always run with
-ReportOnlyfirst to preview what will be cleaned!
| Requirement | Version | Notes |
|---|---|---|
| Windows | 11 | Tested on 23H2/24H2/25H2 |
| 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 |
| Safety Feature | Description |
|---|---|
| π Restore Point | Created before any changes |
| π‘οΈ Protected Paths | System folders never touched |
| π¦ Preserves Packages | NuGet, npm, Maven packages kept |
| β Confirmation | Windows.old asks before deletion |
| π§ Service Recovery | Uses try/finally for services |
| ποΈ Preview Mode | -ReportOnly shows changes first |
C:\Windows\
C:\Program Files\
C:\Program Files (x86)\
C:\Users\
C:\Users\YourName\
| β 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 |
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β WinClean v2.13 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β 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 β
β ββ πΎ Disk Cleanup (20+ categories) β
β ββ π Windows.old Removal (with confirmation) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β PRIVACY (optional) β
β ββ π Clear DNS Cache & History β
β ββ βοΈ Disable Telemetry (if -DisableTelemetry) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β π SUMMARY REPORT β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Every run creates a detailed log:
%TEMP%\WinClean_20260117_143052.log
Log contents:
- β° Timestamp for each operation
- β
Success /
β οΈ Warning / β Error status - π Freed space per category
- β±οΈ Total execution time
Is it safe to run WinClean?
Yes! WinClean creates a restore point before making changes and never touches protected system paths. Use -ReportOnly to preview changes first.
Will it delete my installed programs?
No. WinClean only cleans caches and temporary files. Your installed programs, npm packages, NuGet packages, and user data remain untouched.
How often should I run it?
Monthly is recommended. Heavy developers or users with limited disk space may benefit from weekly runs.
Why does it need Administrator rights?
Required for: Windows Update, system cache cleanup, DISM operations, service management, and creating restore points.
Can I run it on Windows 10?
Primarily designed for Windows 11, but most features work on Windows 10 with PowerShell 7.1+.
What if something goes wrong?
Use the restore point created at the start to roll back. Check the log file for details about what was changed.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - 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 β’ Changelog
Made with β€οΈ for Windows users