# Creates a CSV containing the sizes of the user profile folders on a computer to a CSV named by the computer's hostname
# Run with SCCM or startup script to get data on all computers and then compile results with Power Bi Desktop
$Server = "<FQDN of server>"
$CsvFilePath = "\\$Server\UserProfileSizeReport$\$env:COMPUTERNAME.csv"
$CsvContent = @()
foreach ($folder in (get-childitem C:\Users)) {
$row = New-Object PSObject
$row | Add-Member -type NoteProperty -Name 'User' -Value $folder.Name
$size = [math]::round(((Get-ChildItem $folder.FullName -Recurse | Measure-Object -Property Length -Sum -ErrorAction Silent).Sum / 1MB),2)
# skip the Download folder in the calculation
# [math]::round(((Get-ChildItem C:\Users\aschott -Exclude Documents | Get-ChildItem -Recurse | Measure-Object -Property Length -Sum -ErrorAction Silent).Sum / 1MB),2)
$row | Add-Member -type NoteProperty -Name 'Size-MB' -Value $size
$CsvContent += $row
}
$CsvContent | Export-Csv -noTypeInformation -path $CsvFilePath
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article