Script to get users with roaming profile and profile size

Script to get users with roaming profile and profile size

This question is not answered
Hi Guys,
I am new to the forum. Need some help getting a list of users with romaining profiles and the profile sizes. First part is easy but i am unable to work out how to get the profile size. I have only managed to do below so far

Get-QADUser -sizelimit 0 | where {$_.profilepath -ne $NULL} | Select-object SamAccountName,profilepath

Can someone please assist. Any assistance will be highly appreciated. Thanks
All Replies
  • Hi, try this:

    Get-QADUser -sizelimit 0 | where {$_.profilepath} | Select-object SamAccountName,profilepath, @{Name="Size";Expression={$colItems = (Get-ChildItem $_.profilepath -recurse | Measure-Object -property length -sum);
    "{0:N2}" -f ($colItems.sum / 1MB) + " MB" }}

    I got the size calculation from here:

    Tell me if it worked.
  • Hi Hans,
    Thanks for you reply, the scripts runs but does not return the size (returns 0.00 MB). E.g below
    SamAccountName                          ProfilePath                             Size
    --------------                          -----------                             ----
    fb04                                    \\\path\Profiles\f... 0.00 MB

  • What if you check the foldersize in Explorer ? What size is the profile of fb04 ?

    You could also check what the command shows if executed in the console:

    Get-ChildItem \\\path\profiles\..... -recurse | Measure-Object -property length -sum

    what is the result ??