Nov 052018
Long story short, this is the script I’ve found and is the most accurate / reliable in my experience when used in recurse mode on Citrix user profiles to get the profiles size:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
function Get-FolderSize { [CmdletBinding()] Param ( [Parameter(Mandatory=$true,ValueFromPipeline=$true)] $Path, [ValidateSet("KB","MB","GB")] $Units = "MB" ) if ( (Test-Path $Path) -and (Get-Item $Path).PSIsContainer ) { $Measure = Get-ChildItem $Path -Recurse -Force -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum $Sum = $Measure.Sum / "1$Units" $Sum = "{0:N2} $Units" -f $Sum [PSCustomObject]@{ "Path" = $Path "Size($Units)" = $Sum } } } Get-FolderSize D:\HomeDir\UPM |