An alternative to roaming profiles and folder redirection in the RDS scenarios is RDS User Profile Disks which helps to make configuration and deployment easy.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our customers to set up User Profile Disk in Windows.
In this context, we shall learn the benefits of User Profile Disk and how our Support Experts configure it.
User Profile Disks (UPD) is a new feature of Remote Desktop Services in Windows Server 2012.
The important part of UPD is that it helps 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.
Now let us now focus on some key suggestions as per the suggestion of our Support Engineers.
i. Configuration and deployment is simple
ii. Maintain on pooled virtual desktops that get rolled back after logoff
iii. Less logon and logoff time
iv. Specific to the collection, cannot use on multiple computers simultaneously
v. Administrators can have granular control of exactly which locations get saved to the virtual hard disk (VHDX)
vi. Stored on Server Message Block (SMB) shares, cluster shared volumes, SANs, or local storage.
1. User profile disks are for a single collection.
Here, 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.
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
To begin, it is important to create a shared folder on any corporate file server to store user profiles as VHDX disk.
For instance, 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.
Initially, 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 provide below:
Get-ADUser -Identity S-1-5-21-32549751-3956249758-2943215497-23733695
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> and looks like this:
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.
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.
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;
<#
.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 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\namesp
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.
In this guide, we learnt that RDS User Profile Disks is an alternative to roaming profiles and folder redirection in the RDS scenarios. Also, we saw how to configure it.