Disk space issues are one of the most common causes of slow performance, failed updates, unstable applications, and backup problems on Windows devices. When a workstation or server begins running low on storage, the impact can quickly spread across the system and affect day-to-day operations.

At Osmicro, we commonly use a structured cleanup process to safely reclaim disk space, remove unnecessary files, and identify what is consuming the most storage. This process combines standard Windows cleanup steps with additional remediation tasks for Dell devices and storage analysis using TreeSize Free. If your business needs broader support around IT support, managed IT, or cyber security, this kind of operational hygiene is part of keeping systems stable and reliable.

Quick Summary

  • Empty the Recycle Bin
  • Delete temporary files
  • Run disk cleanup as SYSTEM
  • Remove Dell SupportAssist Remediation snapshot data on Dell devices only
  • Install TreeSize Free to identify space hogs and large datasets

Common Signs of a Disk Space Issue

You may be dealing with a disk space problem if you notice any of the following:

  • Windows updates failing or not downloading
  • Backups failing due to insufficient free space
  • Applications crashing or freezing unexpectedly
  • Very slow boot times or poor system performance
  • Profile or temp folders growing excessively
  • Large hidden folders consuming disk space without being obvious to the end user

Important: Always confirm what type of device you are working on before cleanup. A standard workstation can usually tolerate aggressive temporary file cleanup, but a server or line-of-business device should be reviewed more carefully before deleting data.

Osmicro Disk Space Resolution Process

Our usual process follows a simple progression: clean the obvious junk first, run system-level cleanup tasks next, then inspect the drive using a visual analysis tool to find what is actually consuming the space.

Step 1: Empty the Recycle Bin

Emptying the Recycle Bin is a quick first step and can sometimes recover a significant amount of storage immediately, particularly on shared or heavily used machines.

Clear-RecycleBin -Force

This command forces the Recycle Bin to be emptied without prompting for confirmation.

Step 2: Delete Temporary Files

Temporary files often accumulate in both the user profile and the Windows temp directory. These files are usually safe to clear when they are no longer in active use.

@echo off
echo Clearing User Temporary Files...
del /s /f /q "%USERPROFILE%\AppData\Local\Temp\*.*"
for /d %%D in ("%USERPROFILE%\AppData\Local\Temp\*") do rd /s /q "%%D"
echo Clearing Windows Temporary Files...
del /s /f /q C:\Windows\Temp\*.*
for /d %%D in ("C:\Windows\Temp\*") do rd /s /q "%%D"
echo Cleanup Complete!
pause

This clears:

  • User temp files in %USERPROFILE%\AppData\Local\Temp
  • System temp files in C:\Windows\Temp

Step 3: Run Basic Cleanup as SYSTEM

Running cleanup under SYSTEM can remove data that a standard user context may not be able to access. This is useful when pushing automation through an RMM platform or working in an elevated environment.

# Run this in PowerShell as Administrator
$TempFolders = @(
    "$env:TEMP\*",                     # User Temp
    "$env:SystemRoot\Temp\*",          # Windows System Temp
    "$env:SystemRoot\Prefetch\*"       # Windows Prefetch
)

Write-Host "Cleaning temporary files..." -ForegroundColor Cyan

foreach ($Path in $TempFolders) {
    Remove-Item -Path $Path -Recurse -Force -ErrorAction SilentlyContinue
}

Write-Host "Cleanup Complete!" -ForegroundColor Green

This script targets:

  • User temp files
  • Windows system temp files
  • Windows prefetch files

Step 4: Run Advanced Disk Cleanup as SYSTEM

This is the more complete Osmicro cleanup method. It uses DISM to clean the Windows component store and then runs Windows Disk Cleanup silently with safe categories enabled.

<#
.SYNOPSIS
Runs safe disk cleanup as SYSTEM.
Includes DISM component cleanup (Windows Update files)
and Disk Cleanup (cleanmgr) for temp files.

.DESCRIPTION
- Uses DISM to clean WinSxS / Windows Update leftovers
- Uses cleanmgr for supported temp categories
- Safe for Windows 10/11
- Suitable for NinjaRMM / SYSTEM context
#>

Write-Output "=== Disk Cleanup (SYSTEM-safe) Starting ==="

# ----------------------------------------------------------------------
# STEP 1: DISM Component Store Cleanup (REAL Windows Update cleanup)
# ----------------------------------------------------------------------
Write-Output "Running DISM component store cleanup..."

Start-Process `
    -FilePath "dism.exe" `
    -ArgumentList "/Online /Cleanup-Image /StartComponentCleanup" `
    -Wait `
    -NoNewWindow

Write-Output "DISM cleanup completed."

# ----------------------------------------------------------------------
# STEP 2: Configure Disk Cleanup safe categories
# ----------------------------------------------------------------------
$CleanMgr = "$env:SystemRoot\System32\cleanmgr.exe"
if (-not (Test-Path $CleanMgr)) {
    Write-Output "cleanmgr.exe not found. Skipping Disk Cleanup."
}
else {

    Write-Output "Configuring Disk Cleanup categories..."

    $BaseKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches"

    $SafeCategories = @(
        "Temporary Files",
        "Temporary Setup Files",
        "Delivery Optimization Files",
        "Recycle Bin",
        "Downloaded Program Files"
    )

    foreach ($Category in $SafeCategories) {
        $KeyPath = Join-Path $BaseKey $Category
        if (Test-Path $KeyPath) {
            New-ItemProperty `
                -Path $KeyPath `
                -Name StateFlags9999 `
                -PropertyType DWord `
                -Value 2 `
                -Force | Out-Null
            Write-Output "Enabled cleanup: $Category"
        }
    }

    # ------------------------------------------------------------------
    # STEP 3: Run Disk Cleanup silently
    # ------------------------------------------------------------------
    Write-Output "Running Disk Cleanup..."

    Start-Process `
        -FilePath $CleanMgr `
        -ArgumentList "/sagerun:9999" `
        -Wait `
        -NoNewWindow

    Write-Output "Disk Cleanup completed."
}

Write-Output "=== Disk Cleanup Finished ==="
Write-Output "NOTE: Some space may be reclaimed after the next reboot."

exit 0

This advanced cleanup helps remove:

  • Windows Update leftovers
  • Component store bloat
  • Delivery Optimization files
  • Temporary setup files
  • Temporary files and Recycle Bin contents

Why this matters: DISM component cleanup is one of the safest and most effective ways to reclaim space from Windows servicing files and old update remnants.

Step 5: Remove Dell SupportAssist Remediation Data on Dell Devices Only

On Dell devices, the SupportAssist Remediation snapshot path can sometimes grow very large and consume a major amount of disk space. If the machine is a Dell and this path is confirmed to be a contributor, Osmicro may remove the snapshot backup data and disable it from growing back.

Warning: Only perform this step on Dell devices where SARemediation is confirmed to be consuming disk space and where removing its snapshot data is appropriate for the environment.

<#
.SYNOPSIS
Stops and disables Dell SupportAssist Remediation,
forcibly deletes snapshot backups, and prevents regrowth
WITHOUT requiring a reboot.
#>

# ----------------------------------------------------------------------
# VARIABLES
# ----------------------------------------------------------------------
$ServiceName  = "Dell SupportAssist Remediation"
$BasePath     = "C:\ProgramData\Dell\SARemediation"
$DataPath     = "$BasePath\SystemRepair\Snapshots\Backup"

Write-Output "=== Dell SARemediation NO-REBOOT Cleanup Starting ==="

# ----------------------------------------------------------------------
# STEP 1: Kill SARemediation processes (important under SYSTEM)
# ----------------------------------------------------------------------
$Processes = @(
    "SupportAssistRemediationService",
    "SREngine"
)

foreach ($p in $Processes) {
    Get-Process -Name $p -ErrorAction SilentlyContinue |
        Stop-Process -Force -ErrorAction SilentlyContinue
}

# ----------------------------------------------------------------------
# STEP 2: Stop & Disable SARemediation Service
# ----------------------------------------------------------------------
try {
    $svc = Get-Service -Name $ServiceName -ErrorAction Stop
    Write-Output "Service '$ServiceName' detected. Status: $($svc.Status)"

    Stop-Service -Name $ServiceName -Force -ErrorAction SilentlyContinue
    Set-Service -Name $ServiceName -StartupType Disabled -ErrorAction Stop

    Write-Output "Service stopped and disabled."
}
catch {
    Write-Output "Service '$ServiceName' not found or already disabled."
}

# ----------------------------------------------------------------------
# STEP 3: Disable SARemediation scheduled tasks ONLY
# ----------------------------------------------------------------------
Get-ScheduledTask -ErrorAction SilentlyContinue |
Where-Object {
    $_.TaskName -match "SARemediation|SupportAssist Remediation"
} | ForEach-Object {
    Disable-ScheduledTask -TaskName $_.TaskName -TaskPath $_.TaskPath -ErrorAction SilentlyContinue
    Write-Output "Disabled scheduled task: $($_.TaskName)"
}

# ----------------------------------------------------------------------
# STEP 4: Take ownership & permissions (required for SYSTEM deletion)
# ----------------------------------------------------------------------
if (Test-Path $BasePath) {
    takeown /f "$BasePath" /r /d y > $null
    icacls "$BasePath" /grant SYSTEM:F /t /c > $null
}

# ----------------------------------------------------------------------
# STEP 5: Force delete snapshot data (this frees space immediately)
# ----------------------------------------------------------------------
if (Test-Path $DataPath) {
    cmd.exe /c "rd /s /q `"$DataPath`""
    Write-Output "Snapshot backup data forcibly removed."
}
else {
    Write-Output "Snapshot path not found."
}

# ----------------------------------------------------------------------
# STEP 6: Recreate empty folder and block writes (prevents regrowth)
# ----------------------------------------------------------------------
New-Item -ItemType Directory -Path $DataPath -Force | Out-Null

icacls "$DataPath" /inheritance:r > $null
icacls "$DataPath" /grant:r "SYSTEM:(OI)(CI)R" "Administrators:(OI)(CI)F" > $null
icacls "$DataPath" /deny "SYSTEM:(OI)(CI)W" > $null

Write-Output "Snapshot write access blocked (no reboot)."

Write-Output "=== Dell SARemediation NO-REBOOT Cleanup Complete ==="
exit 0

This is particularly useful when the following path has grown excessively:

C:\ProgramData\Dell\SARemediation\SystemRepair\Snapshots\Backup

Step 6: Install TreeSize Free to Identify Large Data Sets

After clearing obvious junk, the next step is to determine what is still using the space. TreeSize Free is a very useful tool for visually identifying large folders, profile growth, application data, backup remnants, and hidden datasets.

# ==========================================
# Zero-Reboot Chocolatey Install + App Setup
# ==========================================

Write-Host "=== Installing Chocolatey (No reboot required)... ==="

# Ensure TLS 1.2 for older Windows builds
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

# Install Chocolatey silently
Set-ExecutionPolicy Bypass -Scope Process -Force
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

# --- REFRESH ENVIRONMENT VARIABLES WITHOUT REBOOT ---
Write-Host "Refreshing PATH and Chocolatey environment..."

# Add Chocolatey to PATH for this session
$ChocoPath = "$env:ProgramData\chocolatey\bin"
if (-not ($env:PATH -split ";" | Where-Object { $_ -eq $ChocoPath })) {
    $env:PATH = "$env:PATH;$ChocoPath"
}

# Ensure Chocolatey is available in the session
$env:ChocolateyInstall = "$env:ProgramData\chocolatey"

# Reload Chocolatey profile (if available)
$ChocoProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path $ChocoProfile) {
    Import-Module $ChocoProfile -Force
}

# Confirm Chocolatey is ready
Write-Host "Validating Chocolatey availability..."
if (!(Get-Command choco.exe -ErrorAction SilentlyContinue)) {
    Write-Host "ERROR: Chocolatey is not loading. Something went wrong." -ForegroundColor Red
    exit 1
}

Write-Host "Chocolatey installed successfully!"

# ==========================================
# Install packages (customise to your needs)
# ==========================================

$Packages = @(
    "treesizefree"
)

Write-Host "Installing applications via Chocolatey..."
foreach ($pkg in $Packages) {
    Write-Host "Installing $pkg..."
    choco install $pkg -y --ignore-checksums
}

Write-Host "=== All installations completed with no reboot. ==="

Once installed, TreeSize Free can be used to quickly identify:

  • Large user profiles
  • Old installer caches
  • Unexpected backup folders
  • Huge application data directories
  • Log file growth
  • Vendor-specific snapshot or support folders

Suggested Resolution Workflow

For most Windows devices with low disk space, the following workflow is practical and safe:

  1. Check free disk space before changes
  2. Empty the Recycle Bin
  3. Delete temp files
  4. Run basic SYSTEM temp cleanup
  5. Run advanced DISM and Disk Cleanup script
  6. If the device is a Dell, inspect the SARemediation path
  7. Install and open TreeSize Free
  8. Identify the remaining largest folders and review them carefully
  9. Confirm free space after remediation
  10. Reboot if required to finalise locked file cleanup

Note: Some space may not immediately reappear until after a reboot, especially where Windows has pending file locks, update cleanup tasks, or cached system components still in use.

What TreeSize Usually Helps Uncover

In many cases, the built-in cleanup tasks remove only part of the problem. TreeSize Free is often what reveals the true cause of storage exhaustion. Common examples include:

  • C:\Users\<username>\AppData growing excessively
  • C:\Windows\SoftwareDistribution consuming unexpected space
  • Backup software caches or leftover image folders
  • Dell snapshot or remediation data
  • Old downloads or ISO files stored in user folders
  • Application-specific logs or databases

Best Practice Recommendations

  • Always record free space before and after cleanup
  • Use SYSTEM-level cleanup where standard user cleanup is insufficient
  • Only remove Dell SARemediation data on Dell devices where appropriate
  • Use TreeSize Free to validate what is still consuming storage
  • Be cautious on servers and line-of-business machines before deleting non-temp data
  • Document what was removed and any large folders still requiring review

Outcome: This process helps Osmicro reclaim disk space quickly, reduce user disruption, improve system stability, and identify the root cause of storage issues rather than only treating the symptom.

Conclusion

Disk space issues are rarely caused by one thing alone. A proper resolution usually involves clearing temporary data, removing system-level junk, checking for vendor-specific storage growth, and then using a visual analysis tool to find the real storage consumers.

At Osmicro, this combination of Recycle Bin cleanup, temp file deletion, SYSTEM cleanup, Dell SARemediation remediation where needed, and TreeSize Free analysis provides a reliable and repeatable way to resolve low disk space conditions across supported Windows devices. If you are also reviewing wider platform stability, patching, or security posture, our services around patch management, backup and disaster recovery, and service desk support are designed to reduce these issues before they become major business disruptions.