Disk space cleanup candidate report
A read-only disk-pressure report that captures low-space context and returns targeted cleanup candidates from known folders without deleting, compressing, or moving anything.
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
Command Starter
Read-only command: verify target and scope
# ---------------------------------------------------------------------
# Operator inputs
# ---------------------------------------------------------------------
$ComputerName = 'server01'
$OutputPath = '.\disk-cleanup-candidates.csv'
# Keep the starter intentionally scoped. Add application-specific folders only after owner review.
$CandidatePaths = @(
'C:\inetpub\logs\LogFiles',
'C:\Windows\Temp'
)
# ---------------------------------------------------------------------
# Collect the largest files from each approved candidate path
# ---------------------------------------------------------------------
$Results = Invoke-Command -ComputerName $ComputerName -ArgumentList (,$CandidatePaths) -ScriptBlock {
param([string[]]$RemoteCandidatePaths)
foreach ($Path in $RemoteCandidatePaths) {
if (-not (Test-Path -Path $Path)) { continue }
Get-ChildItem -Path $Path -Recurse -File -ErrorAction SilentlyContinue |Manual or UI step
Sort-Object -Property Length -Descending |
Writes local output artifacts: review the output path before running
Select-Object -First 20 |
ForEach-Object {
[pscustomobject]@{
ComputerName = $env:COMPUTERNAME
CandidatePath = $Path
FullName = $_.FullName
SizeMB = [math]::Round($_.Length / 1MB, 2)
LastWriteTime = $_.LastWriteTime
}
}
}
}
# Preserve a review file for owners. This does not remove anything.
$Results | Export-Csv -Path $OutputPath -NoTypeInformation -Encoding UTF8
$Results | Format-Table -AutoSizeValidation
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 targeted cleanup candidates to CSV for owner and retention review.
Attach the folder scope and largest-file evidence to the ticket before proposing cleanup.
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.
Keep candidate paths scoped. Avoid unbounded full-drive recursion during an active incident.
Do not clean Windows, database, backup, or application paths without owner approval and restore expectations.
