User Profile Size Report

Created by Andrew Schott, Modified on Tue, Mar 15, 2022 at 4:54 PM by Andrew Schott

# 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

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article