⚡ PowerShell 5.1+

Get The user CrashDumps folder Size Report

Reports how much disk space the user CrashDumps folder is currently using, read-only (no deletion).

By WindowsScripting.com · 839 B
Get-CrashDumpsSizeReport.ps1
<#
.SYNOPSIS
    Reports how much disk space the user CrashDumps folder is using.

.DESCRIPTION
    Recursively sums the size of every file under the user CrashDumps folder and prints
    a human-readable total, without deleting anything.

.EXAMPLE
    .\Get-CrashDumpsSizeReport.ps1
#>

[CmdletBinding()]
param()

$targetPath = "$env:LOCALAPPDATA\CrashDumps"

if (-not (Test-Path $targetPath)) {
    Write-Host "$targetPath does not exist on this machine." -ForegroundColor Yellow
    return
}

$files = Get-ChildItem -Path $targetPath -Recurse -File -Force -ErrorAction SilentlyContinue
$totalBytes = ($files | Measure-Object -Property Length -Sum -ErrorAction SilentlyContinue).Sum

Write-Host "$targetPath" -ForegroundColor Cyan
Write-Host "  Files: $($files.Count)"
Write-Host "  Total size: $([math]::Round($totalBytes / 1MB, 2)) MB"