Disk space cleanup candidate report
A read-only disk pressure report that finds likely cleanup candidates without deleting logs, caches, dumps, or user data.
Good For
- low disk incidents
- server health checks
- IIS log growth
- patch cache review
- support handoff
How to Use It
- Record which volume is under pressure and the expected owner of the largest workload before reviewing cleanup candidates.
- Capture fixed-disk size and free-space data so the ticket has a before-state.
- Review IIS logs, Windows temp files, crash dumps, installer caches, application logs, and known export folders as separate candidate groups.
- If a candidate path belongs to a database, backup product, monitoring agent, or line-of-business app, stop and confirm retention requirements.
- Export the largest-file findings to CSV when multiple servers or folders need owner review.
- Only move to deletion or archival after the report identifies owner, age, retention expectation, and rollback or restore path.
Execution Modes
- local
- remote-single-host
- remote-host-list
Inputs and Outputs
Inputs
- computer name
- CSV or TXT server list
- known log paths
- retention policy notes
Outputs
- verbose-console
- csv
- future-html-report
Command Starter
Safe to run: read-only
$ComputerName = "server01"
Invoke-Command -ComputerName $ComputerName -ScriptBlock { Get-CimInstance Win32_LogicalDisk -Filter "DriveType=3" | Select-Object DeviceID, Size, FreeSpace; Get-ChildItem C:\inetpub\logs\LogFiles -Recurse -File -ErrorAction SilentlyContinue | Sort-Object Length -Descending | Select-Object -First 20 FullName, Length, LastWriteTime; Get-ChildItem C:\Windows\Temp -Recurse -File -ErrorAction SilentlyContinue | Sort-Object Length -Descending | Select-Object -First 20 FullName, Length, LastWriteTime }Validation
- The report identifies which volume is low and which candidate folders contribute the most space.
- Every cleanup candidate has an owner or service context before any file operation is proposed.
- Post-cleanup validation, if later approved, compares free space against the captured before-state.
Reporting
- export large-file candidates to CSV for owner review
- attach before-state disk usage and candidate paths to the ticket
- promote repeated use into an HTML disk-pressure report with owner and retention columns
Safety Notes
- This report is read-only and should not delete, compress, or move files.
- Do not clean Windows, database, backup, or application paths without owner approval and restore expectations.