Configure RDS User Profile Disks on Windows

Configure RDS User Profile Disks on Windows

User Profile Disks is an alternative to roaming profiles and folder redirection in the RDS scenarios. 

Basically, User Profile Disks (UPD) is a new feature of Remote Desktop Services in Windows Server 2012. 

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).

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to setup User Profile Disk in Windows.

In this context, let's look into how to Configure RDS User Profile Disks on Windows.

More about User Profile Disks (UPD)

As already mentioned, User Profile Disks (UPD) is a new feature of Remote Desktop Services in Windows Server 2012.

The whole point of UPD is to store user and apps data in a separate VHDX disk on the network shared folder.

This virtual disk is mounted to the user session as soon as we sign in to the RDS server, and unmounted when we log out.

Advantages of RDS User Profile Disks:

1. Configuration and deployment is simple

2. Maintain on pooled virtual desktops that get rolled back after logoff

3. Less logon and logoff time

4. Specific to the collection, cannot use on multiple computers simultaneously

5. Administrators can have granular control of exactly which locations get saved to the virtual hard disk (VHDX)

6. Stored on Server Message Block (SMB) shares, cluster shared volumes, SANs, or local storage.

Points to note before we configure RDS User Profile Disks

1. User profile disks are for a single collection.

A user connecting to two different collections will have two separate profiles;

2. Properties are set automatically upon creation and contain all profile data and registry settings by default.

These properties can be defined prior to creation or after in the ‘Session Collection’ properties from ‘Server Manager’;

3. A form of central file share is required as the UNC path of this share is to provide in the wizard during initial configuration.

One major benefit of these file shares is that when more RDS hosts are added to support the collection, those hosts automatically add to the ACL of the share, not requiring an administrator to take any action in modifying security permissions;

4. Single session.

If a user logs into one RDS host, they cannot connect to another and they cannot have more than one session active on a single host;

5. User Profile Disks are created using a naming scheme that corresponds to a user’s GUID and makes identifying the UPD associated with a user a very risky task.

Best practices when working with RDS User Profile Disks

Given that a user will have a UPD respective to each collection, each will therefore require respective file shares. It's advisable to name each file share according to the collection with which it associates.

Leverage the benefits of new file server technology in Server 2012 R2 – Scale Out File Server (SOFS)

+ SOFS differs from clustered file servers in that all file shares on all nodes are always active instead of being active on one node at any given time – active/active instead of active/passive

How to configure RDS User Profile Disks on Windows ?

To begin, it is necessary to create a shared folder on any corporate file server to store user profiles as VHDX disk.

For example, the path to our folder will be: \\rdvh1\DemoLabOficeApp.

Servers which are a part of RDS collection should have full access permission to access this shared folder.

In a single RDS collection, there can exist only one VHDX profile file for one user.

If a user connects to the resources from different collections, we should create a separate profile disk for each.

We can configure RDS User Profile Disks in the collection settings of Remote Desktop Services. We can enable this mode while creating a new collection.

In our example, the collection already exists, so in the Server Manager console, we select this collection and in the upper left corner click Tasks -> Edit Properties.

Here. in User Profile Disks section we ‘Enable’ user profile disks, specify the path to the previous shared folder (\\rdvh1\DemoLabOficeApps) and a maximum profile disk size.

Then we save the changes.

Once done, we make sure to change NTFS permissions for Profile Disks folder. In our case, the collection consists of one RDSH01 server, which has full control permission.

Hence, a full Control permissions is given to the RDSH01 server on the shared folder level.

When we add 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 we do not need to remember to set permissions for the profile folder.

[Need help to configure RDS User Profile Disks on Windows? We are available 24*7. ]

UPD: User profile as VHDX file

First, we have to go to the network shared folder with user profiles.

There is a UVHD-template.vhdx file. This file is the user profile disk template.

When a user logs on to the RDS server for the first time, this template copies and renames as a VHDX file, with user SID in its name.

To match an UPD file name with the user name, we must use a separate script.

For example, we can convert the SID to an account name by using the Get-ADUser cmdlet:

Get-ADUser -Identity S-1-5-21-32549751-3956249758-2943215497-23733695

What does User profile disk contain?

Right-click the VHDX file and select Mount. The UPD disk can only be used in one session on one RDS host (exclusive access). We cannot mount an UPD VHDX disk if the user is currently using it on the RDS server.

As we 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 in the profile.

On the side of RD Session Host server, a .vhdx user’s file is mounted to the C:\users\<username>.

Note that the UPD drive is bound to the RDS server Windows OS version. We cannot transfer (use) an UPD user profile from an RDS server from one version of Windows Server to another.

Data is written to the vhdx file in real time.

When copying data to a user profile on an RDS server, the size of the vhdx file on the shared storage increments immediately.

If the user profile folder already exists in the system, the folder with an old profile renames 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.

The three options:

By default, a User Profile Disk contains all the user profile contents. However, we can exclude certain folders from the list of synchronized directories in the RDS collection settings.

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 us to save only specific directories in the UPD profile.

If necessary, the last option allows us to implement the scenarios for saving the settings of the Start Screen, 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.

[Stuck with User Profile Disks? We are here for you. ]

How to create RDS User Profile Disks Using PowerShell

We 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 we want to run the Resize-VHD cmdlet from a desktop with Windows 10, we must install the feature: Hyper-V -> Hyper-V Platform -> Hyper-V Services.

Now we need to extend the volume from the GUI of the Disk Management console (Action -> Attach VHD -> Extend volume).

Or we use the following PowerShell script to automatically extend the vhdx file to the maximum available size:

This script extend size of VHDX file and resize the disk partition to Max
try {
Mount-VHD -Path $vhdxFile -ErrorAction Stop
catch {
Write-Error “File $vhdxFile is busy”
$vhdx = Get-VHD -Path $vhdxFile
if ($vhdx.Size -ge $vhdxNewSize){
Write-Warning “File $vhdxFile already have this size!”
$vhdx | Dismount-VHD
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
Dismount-VHD -Path $vhdxFile

Note that we cannot extend the user’s UPD disk with an active RDS session.

To reduce the size of the UPD file, we 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 connects to the RDS collection and cannot damage while using the shared profile by several servers.

We can store the User Profile Disks in SMB shares, CSV, SOFS, SAN or on the local disks.

If we are planning to store UPD profiles on DFS servers, we must install Windows Server 2012 R2. If we are using previous versions of Windows Server, we will get an error:

Unable to enable user disks on rVHDShare. 
Could not create template VHD. Error Message: The network location “\\ibmimedia.com\names

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, we recommend to test their work and possible problems in a test environment.

[Need assistance to configure RDS User Profile Disks? We are happy to help.]

Who We Are ?

Most prominent, efficient, and well-performing IT companies and software solutions.

Related Posts