Application virtualization, IoT and Cloud Computing, Blog of Sacha Thomet

Monitor you Profile directories

Since I had worked as a Citrix administrator the size of the profile directories was always a contemporary issue. It’s a fact that with new technologies like Citrix User Profile Manager the possibilities are grown and the life is easier with exclusion lists and profile streaming features. But it’s still a topic to consider if you are a Citrix admin or system engineer. I worked in former company with tools like TreeSize ( or WinDir Stat ( But in some company they wont to spend money for tools which is only usable for one administrator or they don’t trust to OpenSource software (TreeSize).

I have the approach to solve every possible problem with on-board tools. So I created now a small script what give me the possibility to check my Profile directory with one recursive level so that I get each Size of a Profile within his subdirectories.:

# Created on: 10.2015 Version: 0.3
# Created by: Sacha Thomet
# Filename: GetSubdirSizes.ps1
# Description: Collect Size of Dir's and Subsirs
# Prerequisite: None
# Call by : Manual
# Change Log:
# V0.1 first version
# V0.2 only 1 recursive subfolder
# V0.3 corrections of calculation

$path = "\localhostC$tempprofiles"
$top = "4000"
$outputpath = "C:tempSubdirSize-Report.txt"

Function Get-FolderSize
 $Sizes = 0
 ForEach ($Item in (Get-ChildItem $Path))
 If ($Item.PSIsContainer) {$Sizes = (Get-ChildItem $path"$Item" -recurse | Measure-Object -property length -sum).sum}
 Else {Write-Host "No Subfolder"}

 $SizeFormated = "{0:N2}" -f ($Sizes/1MB)
 New-Object PSObject -Property @{'Folder'=$Item;'Size'=$SizeFormated }
$outfile = Get-FolderSize $path | sort -property Size –Descending |select -first $top
$outfile | out-file $outputpath
echo $outfile

5 Responses to Monitor you Profile directories

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Language switcher