$volumePath = "C:\" # Replace this with the path of the volume root you want to analyze
# Get all directories at the root of the volume
$directories = Get-ChildItem -Path $volumePath -Directory
# Calculate size for each directory
foreach ($dir in $directories) {
$dirSize = (Get-ChildItem -Path $dir.FullName -Recurse -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum -ErrorAction SilentlyContinue).Sum
$dirSizeGB = [math]::Round($dirSize / 1GB, 2) # Convert bytes to gigabytes
Write-Output "$($dir.Name) - $dirSizeGB GB"
}