๐ง Recipe ยท Troubleshooting & Diagnostics
Free Up Disk Space on a Windows Workstation
Diagnose and reclaim storage on Windows endpoints when users hit low-disk warnings
Complexity
Beginner
Impact
endpoint-health + user-productivity + preventive-maintenance + windows
Context
Why This Matters
Windows shows a low-disk warning when the system drive (usually C:) drops below roughly 10% free. Once free space falls under ~1-2 GB, Windows Update may fail, applications crash on save, temp files can't be written, and user productivity grinds to a halt. This recipe walks through the standard triage: identify what is consuming space, safely remove known-disposable data, and leave the workstation in a healthy state without touching user documents.
Run this when a user reports a "Low Disk Space" toast, a red bar on the C: drive in File Explorer, application errors such as "There is not enough space on the disk", or OneDrive/Teams sync failures caused by the local cache running out of room.
Expected Outcomes
- The system drive has at least 15-20% free space restored.
- Temporary files, Windows Update caches, old Windows installations, and Recycle Bin contents are cleared.
- Top space consumers are identified so you know whether this is a recurring problem (e.g., oversized OneDrive cache, bloated user profile, large Downloads folder).
- User data (Documents, Desktop, Pictures, Outlook OST within reason) is left intact.
- Storage Sense is enabled so the machine self-maintains going forward.
Risks & Considerations
Do not blindly delete
- Never delete from
C:\Users\<name>\directly without confirming with the user โ Documents, Desktop, and Downloads often contain the only copy of important files. - Outlook OST files (in
%LocalAppData%\Microsoft\Outlook) can be several GB. Deleting them forces a full resync which is fine on a fast connection but painful on remote/VPN users. - OneDrive/SharePoint cached files: use "Free up space" from the OneDrive context menu rather than deleting the folder.
- Windows.old can only be removed within 10 days of a feature update โ after that Windows cleans it automatically. Do not force-delete it during that window or rollback becomes impossible.
- Hibernation file (
hiberfil.sys) can be large. Only disable hibernation on desktops; on laptops it breaks fast startup and hybrid sleep. - Pagefile โ do not delete or disable unless you know the machine has adequate RAM and you understand the impact on crash dumps.
Compliance
On managed/regulated endpoints, check whether your DLP or eDiscovery policies require preservation of temp files or browser caches before running cleanup.
Required Permissions
| Permission | Why It's Needed |
|---|---|
| Local Administrator on the workstation | Required to run Disk Cleanup with system files, clear the SoftwareDistribution cache, and remove Windows.old. |
| Intune Device Configuration (Read/Write) | Optional โ only if deploying Storage Sense policy or a remediation script tenant-wide. |
| DeviceManagementManagedDevices.ReadWrite.All | Graph permission required to trigger a proactive remediation or custom script against the device via Intune. |
The fastest way to get this done: just ask Dex. Copy the prompt below and paste it into your Dex conversation.
For IT Admins
Paste into Dex Pro
For End Users
How an employee would ask Dex for help
Manual cleanup via Windows GUI
1. See what's using the space
- Open Settings โ System โ Storage.
Settings > System > Storage
- Wait for Windows to categorize usage (Apps, Temporary files, System & reserved, etc.).
- Note the top 2-3 categories โ these are your targets.
2. Run Storage cleanup
- Still under Settings โ System โ Storage, click Temporary files.
- Review the checklist. Safe to tick: Windows Update Cleanup, Delivery Optimization Files, Thumbnails, Temporary files, Recycle Bin, Previous Windows installations (only if >10 days old and user is happy), Downloads (โ ๏ธ only with user consent).
- Click Remove files.
3. Turn on Storage Sense (prevent recurrence)
- Under Storage, toggle Storage Sense on.
- Click it to configure: run Every week, delete files in Recycle Bin after 30 days, delete files in Downloads Never (safer default), and set OneDrive content to become online-only after 30 days.
4. Uninstall unused apps
- Go to Settings โ Apps โ Installed apps.
- Sort by Size (largest first).
- Remove anything the user confirms is unused (old games, trial software, duplicate browsers).
5. Offload OneDrive files
- Right-click the OneDrive folder in File Explorer.
- Choose Free up space โ files become online-only but still visible.
6. Visualize remaining large files (optional)
If space is still tight, install WizTree or TreeSize Free (both admin-approved in most environments) to find rogue log files, old VM images, or dev artefacts. Never delete anything under C:\Windows or C:\ProgramData without certainty.
Not applicable for direct Windows disk cleanup. Windows does not expose a native REST API for local disk operations. If you manage the fleet with Intune, you can automate this at scale using Proactive Remediations (script packages) โ the Graph API endpoint to deploy one is:
POST https://graph.microsoft.com/beta/deviceManagement/deviceHealthScriptsYou upload a detection script and a remediation script (both PowerShell), then assign them to a device group. To trigger an on-demand run against a specific device:
POST https://graph.microsoft.com/beta/deviceManagement/managedDevices/{deviceId}/initiateOnDemandProactiveRemediation
Content-Type: application/json
{
"ScriptPolicyId": "<deviceHealthScript id>"
}For a single workstation, the PowerShell approach below is faster and more practical.
PowerShell cleanup script
Run PowerShell as Administrator on the affected workstation. The script below:
- Reports current free space.
- Empties user and system temp folders.
- Clears the Windows Update download cache (
SoftwareDistribution\Download). - Runs the built-in
cleanmgrwith a preset profile (no GUI prompts). - Empties the Recycle Bin for all users.
- Reports final free space and space reclaimed.
Typical recovery on a neglected machine: 5-30 GB. On a well-maintained machine: under 1 GB.
Quick one-liners
# Check free space
Get-Volume -DriveLetter C | Select-Object DriveLetter, @{n='FreeGB';e={[math]::Round($_.SizeRemaining/1GB,2)}}, @{n='TotalGB';e={[math]::Round($_.Size/1GB,2)}}
# Clear user temp
Remove-Item -Path "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue
# Clear Windows Update cache (requires admin)
Stop-Service wuauserv -Force
Remove-Item -Path "C:\Windows\SoftwareDistribution\Download\*" -Recurse -Force -ErrorAction SilentlyContinue
Start-Service wuauserv
# Empty Recycle Bin
Clear-RecycleBin -Force -ErrorAction SilentlyContinueUse the full script below for a safer, logged run.
Next steps