8,330 questions
How about this.
Get-ChildItem "C:\temp" | Where-Object { $_.PSIsContainer } | ForEach-Object {
[PSCustomObject]@{
'Name' = $_.FullName;
'MB' = [Math]::Round((Get-ChildItem $_.FullName -Recurse | Measure-Object -Property Length -Sum).Sum / 1MB, 2)
}
} | Export-Csv -Path "c:\temp\report.csv" -NoTypeInformation
Get-Content "c:\temp\report.csv"