Quick fix: Open PowerShell (Admin). Run: Start-Process "cleanmgr.exe" -ArgumentList "/sagerun:1" -Verb RunAs. For Storage Sense specifically (not Disk Cleanup): there’s no direct CLI; trigger via registry: schtasks /run /tn "\Microsoft\Windows\DiskCleanup\SilentCleanup". This runs the same cleanup that Storage Sense would.
Storage Sense is the Windows 11 setting that auto-deletes temp files, old downloads, recycle bin items on a schedule. To force it to run now: trigger the SilentCleanup scheduled task, or invoke Disk Cleanup with command-line flags.
Affects: Windows 11 (and Windows 10).
Fix time: ~5 minutes.
What causes this need
Manually running Disk Cleanup via GUI is slow. Scheduling via Storage Sense waits for the next scheduled time. For: scripting cleanup, freeing space after a big install, cleanup before backup, automation in PowerShell — you need CLI access. Two paths: cleanmgr.exe (Disk Cleanup) and the SilentCleanup scheduled task.
Method 1: Run Disk Cleanup with preset profile
The standard route.
- First, create a cleanup profile. Open Admin Command Prompt.
- Run:
cleanmgr /sageset:1. UI opens. - Tick items to clean: Temporary Files, Recycle Bin, Windows Update Cleanup, Delivery Optimization, Thumbnails, etc.
- Click OK. Profile saved as profile 1.
- To run the profile silently:
cleanmgr /sagerun:1Cleanup runs in background. UI shows progress.
- For multiple profiles (different settings): use /sageset:2, /sageset:3, etc.
- For automatic schedule: Task Scheduler → create task → run
cleanmgr /sagerun:1weekly. - For listing all items cleaned: check Volume size before and after.
This is the standard CLI approach.
Method 2: Trigger Storage Sense scheduled tasks
For triggering the Windows-managed cleanup.
- Open Admin Command Prompt or PowerShell.
- List relevant tasks:
schtasks /query /tn "\Microsoft\Windows\DiskCleanup\SilentCleanup"Shows the SilentCleanup task — the one Storage Sense uses.
- Run the task:
schtasks /run /tn "\Microsoft\Windows\DiskCleanup\SilentCleanup"Runs in background. May take 5-30 minutes depending on file count.
- For Storage Sense’s schedule settings: Settings → System → Storage → Storage Sense. Configure intervals, what to clean.
- For PowerShell trigger:
Start-ScheduledTask -TaskPath "\Microsoft\Windows\DiskCleanup\" -TaskName "SilentCleanup" - Monitor: Task Scheduler → Microsoft → Windows → DiskCleanup → SilentCleanup → Last Run Result shows success/error.
- Caveat: SilentCleanup uses Disk Cleanup’s default profile, not Storage Sense’s. Storage Sense itself runs only on its own schedule.
This is the scheduled-task trigger.
Method 3: Use PowerShell module or write custom cleanup
For granular control.
- For specific item types beyond Disk Cleanup’s scope:
# Clear all user temp files Get-ChildItem $env:TEMP -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue # Clear Windows Defender quarantine Get-ChildItem "$env:ProgramData\Microsoft\Windows Defender\Scans\*" -Recurse | Remove-Item -Recurse -Force # Clear browser caches (close browsers first) Remove-Item "$env:LOCALAPPDATA\Microsoft\Edge\User Data\Default\Cache" -Recurse -Force # Clear thumbnail cache Stop-Process -Name explorer -Force Remove-Item "$env:LOCALAPPDATA\Microsoft\Windows\Explorer\thumbcache*.db" -Force Start-Process explorer - Save as .ps1 script. Run as Admin.
- For automation: Task Scheduler trigger script weekly.
- For older files in Downloads: delete files older than N days:
$daysOld = 30 Get-ChildItem "$env:USERPROFILE\Downloads" -Recurse | Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-$daysOld) } | Remove-Item -Recurse -Force - For shadow copies cleanup:
vssadmin delete shadows /for=C: /oldest(deletes oldest). - For Windows Update cleanup specifically:
dism /online /cleanup-image /startcomponentcleanup /resetbase. Deep cleanup. - For OneDrive cache management: not via Disk Cleanup. Right-click OneDrive icon → Settings → Free up disk space.
This is the deep custom approach.
How to verify the fix worked
- Settings → System → Storage shows disk usage breakdown. Temporary files / Recycle Bin amounts dropped.
- C: drive free space increased.
- Task Scheduler → SilentCleanup shows Last Run Result: 0x0 (success).
- cleanmgr.exe output (if you used Method 1) shows cleanup completed.
If none of these work
If cleanup runs but no space freed: Items not selected in profile: re-run cleanmgr /sageset:1 and tick more categories. System file cleanup: need elevated rights. Run cleanmgr as Admin. Permissions on AppData / Temp: some files in use can’t delete. Reboot first. Windows.old folder: 10-25GB after major upgrade. Use cleanmgr with “Previous Windows installation(s)” ticked. For chronic full disk: WinDirStat or WizTree shows what’s actually using space. Address that. For Storage Sense not running scheduled: Settings → Storage → Storage Sense → verify it’s enabled and run schedule set. For deep system clean: dism /online /cleanup-image commands free more space than Disk Cleanup.
Bottom line: Set up profile with cleanmgr /sageset:1, run with cleanmgr /sagerun:1. Or trigger Windows’s SilentCleanup task: schtasks /run /tn "\Microsoft\Windows\DiskCleanup\SilentCleanup".