User Profile Disks (UPD) is a new feature of Remote Desktop Services in Windows Server 2012. User Profile Disks is an alternative to roaming profiles and folder redirection in the RDS scenarios. The point of UPD is that user and apps data (i. e., a user profile) are stored as a separate VHDX disk on dedicated file on the network shared folder. This virtual disk is mounted to the user session as soon as the user signs in to the RDS server, and unmounted when he logs out (all changes to the user profile are saved to the vhdx disk).
In this article, we’ll describe how to configure and use User Profile Disks on a server with Remote Desktop Services role running on Windows Server 2012 / 2012 R2 / 2016.
Configuring User Profile Disks on Windows Server RDS
First of all, it is necessary to create a shared folder on any corporate file server to store user profiles as VHDX disk (if you want to have high availability for UPD disks, you can place UPD files on a clustered file resource). In our example, the path to this folder looks like this: \\rdvh1\DemoLabOficeApp. Servers being a part of RDS collection have to be given full access permission to access this shared folder.
User Profile Disks mode can be enabled and configured in the collection settings of Remote Desktop Services. This mode can be enabled when creating a new collection, or you can come back to it later.
In our example, the collection already exists, so in the Server Manager console, select this collection and in the upper left corner click Tasks -> Edit Properties.
Then in User Profile Disks section check Enable user profile disks, specify the path to the previously created shared folder (\\rdvh1\DemoLabOficeApps) and a maximum profile disk size (let it be 20 GB). Save the changes.
After you saved the changes, make sure that NTFS permissions for Profile Disks folder have been changed. In our case, the collection consists of one RDSH01 server, which is granted full control permission.
Full Control permissions has been granted to the RDSH01 server on the shared folder level.
When adding new RD Session Host servers to the RDS collection, the wizard automatically changes the folder permissions and gives access to the new servers. It is very convenient, since when scaling a terminal farm you don’t need to remember to set permissions for the profile folder.
UPD: User profile as VHDX file
Go to the network shared folder with user profiles. A UVHD-template.vhdx file is now being stored here.
This file is the user profile disk template. When a user logs on to the RDS server for the first time, this template is copied and renamed as a VHDX file, containing user SID in its name.
Get-ADUser -Identity S-1-5-21-32549751-3956249758-2943215497-23733695
Let’s see what a user profile disk contains. To do it, right-click the VHDX file and select Mount. The UPD disk can only be used in one session on one RDS host (exclusive access). You can’t mount an UPD VHDX disk if the user is currently using it on the RDS server.
As you can see, the VHDX disk contains a set of folders and files of a standard user profile. At logon, a user gets completely transparent access to the data stored in the profile.
On the side of RD Session Host server, a .vhdx user’s file is mounted to the C:\users\<username> and looks like this:
Data is written to the vhdx file in real time. It means that when copying data to a user profile on an RDS server, the size of the vhdx file on the shared storage is incremented immediately.
If the user profile folder already exists in the system, the folder with an old profile is renamed to the <username>-BACKUP-<number>.
The VHDX disk is mounted when the user session starts on a VDI or RDS server. A list of connected UPD disks with profiles can be listed using the mountvol utility.
By default, a User Profile Disk contains all the user profile contents. However, you can exclude certain folders from the list of synchronized directories in the RDS collection settings, or specify that only certain folders should be saved. Thus, all the changes made during the user’s terminal session to the folders in the list of excluded directories are not saved into the VHDX disk on the shared folder.
The second option allows you to configure the saving only the specified directories in the UPD profile.
If necessary, the last option allows you to implement the scenarios for saving the settings of the Start Screen, which are stored in appsfolder.itemdata-ms file. In this example, we have only added the path to \AppData\Local\Microsoft\Windows folder as an additional path to be saved in the UPD.
Resizing User Profile Disks Using PowerShell
You can extend the virtual vhdx drive with the user’s UPD profile using the PowerShell cmdlet Resize-VirtualDisk from the Hyper-V module.
Net use U: \\rdvh1\DemoLabOficeApps
Resize-VHD -Path u:\UVHD-<SID>.vhdx -SizeBytes 40GB
Net use U: /delete
If you want to run the Resize-VHD cmdlet from a desktop with Windows 10, you must install the feature Hyper-V -> Hyper-V Platform -> Hyper-V Services.
Now you need to extend the volume from the GUI of the Disk Management console (Action -> Attach VHD -> Extend volume).
Or use following PowerShell script to automatically extend the vhdx file to the maximum available size:
<#
.Synopsis
This script extend size of VHDX file and resize the disk partition to Max
#>
Param(
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
[alias("Path")]
[string]$vhdxFile,
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
[alias("Size")]
[int64]$vhdxNewSize
)
begin{
try {
Mount-VHD -Path $vhdxFile -ErrorAction Stop
}
catch {
Write-Error "File $vhdxFile is busy"
Break
}
$vhdx = Get-VHD -Path $vhdxFile
if ($vhdx.Size -ge $vhdxNewSize){
Write-Warning "File $vhdxFile already have this size!"
$vhdx | Dismount-VHD
Break
}
}
process{
Dismount-VHD -Path $vhdxFile
Resize-VHD -Path $vhdxFile -SizeBytes $vhdxNewSize
$vhdxxpart = Mount-VHD -Path $vhdxFile -NoDriveLetter -Passthru | Get-Disk | Get-Partition
$partsize = $vhdxxpart | Get-PartitionSupportedSize
$vhdxxpart | Resize-Partition -Size $partsize.SizeMax
}
end{
Dismount-VHD -Path $vhdxFile
}
Note that you can’t extend the user’s UPD disk with an active RDS session.
To reduce the size of the UPD file (assuming that you deleted the user’s data inside the vhdx file and the file size on the disk is less than the size assigned to it), you can use the commands:
resize-VHD \\rdvh\DemoLabOficeApps\UVHD-<SID>.vhdx –ToMinimumSize
And then:
Optimize-vhd -path \\rdvh1\DemoLabOficeApps\UVHD-<SID>.vhdx -mode full
So, we have discussed the major peculiarities of User Profile Disks in RDS/VDI solutions running Windows Server 2016 and 2012 R2. UPD configuration is much easier than the configuration of roaming profiles or redirected folders. The disks are connected to the RDS collection and can’t be damaged when using the shared profile by several servers (unlike the standard profiles). The User Profile Disks can be stored in SMB shares, CSV, SOFS, SAN or on the local disks. Also, Microsoft notes that the speed of loading the user’s desktop environment in case of using UPD is reduced.
If you are planning to store UPD profiles on DFS servers, be aware that they must have Windows Server 2012 R2 installed. If you are using previous versions of Windows Server, you will get an error:
Unable to enable user disks on rVHDShare. Could not create template VHD. Error Message: The network location "\\woshub.com\namespace\UserProfileDisk" is not available.
Also it is desirable to use the version SMB 3.02 on the file server side (Windows Server 2012 R2) or higher.
Anyway, since User Profile Disks is a relatively new technology, prior to mass UPD implementations, it is recommended to test their work and possible problems in a test environment.
17 comments
Can we delete all VHDX files ? It is occupying arround 18 GB of space. please suggest. Thanks
If these vhdx files are not used , of course you can delete them.
If you are not sure – rename files and look at the operation of the system.
We are implementing VDI currently and we only have a couple of users on a pooled desktop using VDI with UPDs. Someone of these user will sometimes get logged in with a temporary profile. This is extremely problematic. I have searched everywhere and cannot figure out why this is happening. Even on the data server where the UPDs are stored, it shows them having a connected to the UPD and all folder redirects are working but the settings that they change that are saved in the UPD are not coming through. Any tips on how to solve this issue??
Do you use Round Robin DNS with farm name on each host in RDS farm?
This is wrong for server 2012. Try to create an A record with the farm name in DNS, which then refers to the broker address/
On the broker server create a registry entry:
Path: HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\Cluster Settings
Type: REG_SZ
Value for desktop collection: TSV: // MS Terminal Services Plugin.1.Name
Value For VDI: TSV: //VMResource.1.Name
No we do not use a Farm, these are Virtual Desktops.
We are using the RD Virtualization Host Method with a MasterImage to create each user their own VM. Not the RD session Host Method that you are referring to. So your fix for the Registry does not apply.
Are UPS disks required? If we’re happy with pure folder redirection to their respective servers…?
You can use User Profile Disks together with the Redirected Folders
In 2016 I noticed a phenomenon that you cannot mount/access the UPD disk with domain admin. It only worked as a local admin.
On the file share that a UPD was stored (and UPD was dismounted when user wasn’t logged in) – this was the case to login as a local admin.
On the RDS session host that a UPT was mounted (when a user was logged in) – again this was the case to login as a local admin to access the files on the UPD.
can i edit the users registry setting for short date format in the UPD
Mount user’s UPD and load the registry hive as follows:
1) Run regedit
2) Select the menu File – > “Load Hive”
3) Go to the mounted drive and select the NTUSER.DAT file
4) Don’t forget to unload the hive after editing
We use UserProfileDisk (RDS) on an Server 2016. But when a lot of users connect to the Server 2016, every UPD maps to an drive letter, so sometimes the networkdrives are occuped with the UPD-Mapping Drives.
Can i exclude for the mapping some letters used for networkdrives like T:\ I:\ and J:\?
Hi, thank you for this article. Do you know a way of switching back from UPDs to a “normal” roaming profile? We have performance issues on one 20102R2 RDS-Server and i want to see if this has to do with the UPSs.
[…] Originally Posted by mavhc Just for RDS, right? Yes, only for RDS. UPDs are configured when you first set up the RDS server. User Profile Disks on Windows Server 2012 R2 / 2016 RDS | Windows OS Hub […]
Where could I grab the ShowUPDFolderDetails.ps1 file now that gallery on technet has been removed ?
“Note that the UPD drive is bound to the RDS server Windows OS version. You can’t transfer (use) an UPD user profile from an RDS server from one version of Windows Server to another.”
How do migrate 2012R2 RDSH Farm using UPD to 2019 RDSH Farm?
Two weeks ago we have to install a new server (Windows S. 2012R2) as terminal server. There was ServerA ; ServerB; and now ServerC We tried to clone the ServerB to ServerC but because of issue with the Uid we decided to install a brand new system.
After the clean install of windows ready, we:
install some application
patches
put to domain
etc..etc..
After this step we put this ServerC to the session host server group. Configure everything as the ServerA and ServerB.
–> Login as domain user, and test…–> Everything fine –> Login as local administrator –> Local administrator get TEMP profile
Rollback an earlier snapshot and test again: –> Login as local administrator –> Local administrator fine!
–> Put server as session host..configure everything –> Login as domain user, and test…–> Everything fine –> Login as local administrator –> Local administrator get TEMP profile
Any idea what the hack is goin’? May i miss something? Why local administrator get Temp profile after add the server as a new RD session host?
Do you use User Profile Disks (UPD)? If so, then this is the reason, since the UPD can only be connected to one RDSH at a time.
if your admin session is active on ServerA then if it is logging in to ServerC, it can’t attach the UPD as it’s already in use, so a temporary profile is used.