When using Microsoft User Profile Disks you also know the tool Sidder: https://gallery.technet.microsoft.com/Sidder-Quickly-see-which-fa6360b3
This tool will show the username who belongs the the User Profile Disk.

I’ve found this not so conveniant as you must run it every time you want to know the username.

So I dusted off my powershell skills and created this little powershell script which will add a text file next to the UPD with the username at the end of the filename.

Keep in mind, I’m not a devver, so I’m sure you can make this PowerShell script in a one or two liner but hey, it just works. 😉

My LAB UPD Store look like this at the moment:

After running the script it looks like this:

You can schedule this script to run every night. Or manually when needed.

Click to: Download


Jeroen Tielen

Experienced Consultant/Architect with a demonstrated history of working in the information technology and services industry. Skilled in Citrix, Microsoft, VMware, Ivanti, etc.

2 Comments

sysadmin47 · April 13, 2023 at 07:41

I found this script from https://learn.microsoft.com/en-us/answers/questions/1005700/show-usermame-linked-to-upd-drive

I would like to point out that your script doesn’t properly handle the situation where the user has been deleted. The script will apply the username from a previous file, because the variables are not initialized each time.

I am not a coder either, but I have updated the script to put “UNKNOWN” if the SID cannot be translated back to a username.

#——————————– Script ——————————–

$Files = gci $UPD_Location -Name

Foreach ($SID in $Files) {
If ($SID -match “.vhdx”) {
$SID = $SID.Substring(5) -replace “.vhdx”
If ($SID-match “template”) {
Write-Host “Template File”
} Else {
$objUser = “UNKNOWN”
$UserName = “UNKNOWN”
$objSID = New-Object System.Security.Principal.SecurityIdentifier ($SID)
$objUser = $objSID.Translate( [System.Security.Principal.NTAccount])
$UserName = $objUSer.Value.trim(“$DomainName\”)
$TextFile = $UPD_Location + “\UVHD-” + $SID + ” ” + $UserName + “.txt”
New-Item $TextFile -ItemType file -Force
}
}
}

    Jeroen Tielen · April 13, 2023 at 10:14

    Hi Kevin,

    UPD should not be used anymore. You should switch to FSLogix 😉

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

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

%d bloggers like this: