Measures each first-level folder under a path recursively and reports the sizes largest first, with a total at the end. The complement to the largest-files hunt: this is the one that tells you which department's share grew, rather than which single file is big.
powershell
# Folder Size Report
# Single use case: report the size of each first-level folder under a path
#-----------------------------------------------------------------
function Write-Log {
param($Message)
Write-Host "<WRITE-LOG = `"*$Message*`">"
}
# --- Parameters (replace via ServerEngine API parameters if needed) ---
$SearchPath = "C:\"
if (-not (Test-Path $SearchPath)) {
Write-Log "Path not found: $SearchPath"
return
}
Write-Log "Measuring first-level folders under $SearchPath (this can take a while)..."
$results = foreach ($dir in (Get-ChildItem $SearchPath -Directory -Force -ErrorAction SilentlyContinue)) {
$bytes = (Get-ChildItem $dir.FullName -Recurse -File -Force -ErrorAction SilentlyContinue |
Measure-Object Length -Sum).Sum
[pscustomobject]@{ Folder = $dir.FullName; GB = [math]::Round(($bytes / 1GB), 2) }
}
if (-not $results) { Write-Log "No folders found under $SearchPath."; return }
Write-Log "================ Folder Sizes ================"
foreach ($r in ($results | Sort-Object GB -Descending)) {
Write-Log "[$($r.GB.ToString().PadLeft(9)) GB] $($r.Folder)"
}
$total = [math]::Round(($results | Measure-Object GB -Sum).Sum, 2)
Write-Log "Folder size report complete: $total GB in $(@($results).Count) folder(s)."Run it across your fleet
This script runs as-is on a single host. Paste it into ServerEngine to schedule it, run it on a whole server group in parallel, and keep the credentials out of the file — see the scripts documentation and the credential store.
More in Windows Server Roles
Report Installed Server Roles with PowerShell
2026-08-17Report DHCP Scope Utilization with PowerShell
2026-08-17Create a DNS A Record with PowerShell
2026-08-17Clear the DNS Server Cache with PowerShell
2026-08-17Find the Largest Files in a Folder with PowerShell
2026-08-17Report SMB Shares and Permissions with PowerShell
2026-08-17Ready when you are.
Try ServerEngine free for 7 days.