Using custom names for folders and containers

Published Jul 29 2022 11:28 AM 770 Views
Microsoft

FSLogix creates containers and folders using a default naming convention. Folders are created using the default value %sid%_%username% and can be customized by modifying registry setting SIDDirNamePattern or GPO setting “SID directory name pattern string”. For the containers name, the default value is Profile_%username% for Profile container and ODFC_%username% for Office container and can be customized by modifying registry setting VHDNamePattern or GPO setting “VHD name pattern string”.

Here in the support team, we have seen many cases where configuring these two values will cause an odd issue: your FSLogix container is loaded the first time, but consecutive times it is not loaded. To understand why this issue occurs, we will need to look in depth at the different values that are used when the profile is created and when it is loaded.

Every time a user logs in, we will always verify if a container exists using the following parameters to determine where to look and what to look for:

 

  • VHDLocations or CCDLocations.
  • SIDDirNameMatch
  • VHDNameMatch
  • VolumeType

This means that we will search for an existing container here: VHDLocations\SIDDirNameMatch\VHDNameMatch.VolumeType

If the profile does not exist, then we will create a new container using the following parameters:

 

  • VHDLocations or CCDLocations.
  • SIDDirNamePattern
  • VHDNamePattern
  • VolumeType

Putting the values together will result in creating the container here VHDLocations\SIDDirNamePattern\VHDNamePattern.VolumeType

In paper this looks easy to follow and you might be wondering where the problem is and why dedicate a blog to talk about this. Well, the problem is that, many times, when you want to customize either the directory or container naming convention, most of the times only SIDDirNamePattern and VHDNamePattern are modified resulting in an undesirable situation.

To better understand this, we will use the following configuration values:

 

  • VHDLocations: \\sample.file.core.windows.net\fslogix
  • SIDDirNameMatch: Default - %sid%_%username%
  • SIDDirNamePattern: Custom - %username%.%userdomain%
  • VHDNameMatch: Default - Profile*
  • VHDNamePattern: Custom - %username%
  • VolumeType: Default – vhd
  • Username: testuser
  • Domain dev
  • SID: SID S-1-5-21-2345234234-2346554-8794543-1710

Let’s review what would happen during the first two logons for a new user:

  • User logs in for the first time and, as we previously explained, we check for an existing profile using the following parameters: VHDLocations\SIDDirNameMatch\VHDNameMatch.VolumeType. Using the given values, we will be checking for an existing file that matches this: \\sample.file.core.windows.net\fslogix\S-1-5-21-2345234234-2346554-8794543-1710_testuser\Profile*.vhd.
  • Since this is the first time that the user login (we know that) and the profile container does not exist, we will create a new container using the following parameters: VHDLocations\SIDDirNamePattern\VHDNamePattern.VolumeType. With the provided values, we will create our container here: \\sample.file.core.windows.net\fslogix\testuser.dev\testuser.vhd.

At this point the user testuser has a new profile container created and we will expect that the next time it logs in, his new profile is loaded. Let’s review what happens during the second login:

  • User logs in for the second time and, as I mentioned before, we will always look for an existing profile first, so we will check for an existing profile here: \\sample.file.core.windows.net\fslogix\S-1-5-21-2345234234-2346554-8794543-1710_testuser\Profile*.vhd. The result for this first operation is “File does not exist”, so we proceed to create a new profile, but then the creation of the new profile fails with error “File already exist”.

How could this be possible if the user was able to login successfully and create its profile but the subsequent times it is erroring with “File already exist”? Perhaps you already spotted the cause, and I am glad that you did it. If not, keep reading.

The reason for the error is because you are using two different locations based on the settings you have:

 

When creating a profile

VHDLocations\SIDDirNamePattern\VHDNamePattern.VolumeType

\\sample.file.core.windows.net\fslogix\testuser.dev\testuser.vhd.

When looking for a profile

VHDLocations\SIDDirNameMatch\VHDNameMatch.VolumeType

\\sample.file.core.windows.net\fslogix\S-1-5-21-2345234234-2346554-8794543-1710_testuser\Profile*.vhd

 

You will notice that the path is different since one of them does not have the SID. But there is also, there is another difference, and it is in the filename, because we are looking for any file that has “Profile” at the beginning of the name. Let’s look at FSLogix Profile log for this entire process and see what we find.

 

  • Every time we have a user login, we will log current values. Here is the section of interest

 

[21:02:09.727][tid:00000dd0.00001c0c][INFO]             Configuration setting not found: SOFTWARE\FSLogix\Profiles\SIDDirNameMatch.  Using default: %sid%_%username%

[21:02:09.727][tid:00000dd0.00001c0c][INFO]             Configuration setting not found: SOFTWARE\FSLogix\Profiles\VHDNameMatch.  Using default: Profile*

[21:02:09.727][tid:00000dd0.00001c0c][INFO]             Configuration setting not found: SOFTWARE\FSLogix\Profiles\VolumeType.  Using default: vhd

[21:02:09.743][tid:00000dd0.00001c0c][INFO]             FindFile returning after 16 milliseconds

[21:02:09.743][tid:00000dd0.00001c0c][INFO]             Configuration Read (REG_SZ): SOFTWARE\FSLogix\Profiles\SIDDirNamePattern.  Data: %username%.%userdomain%

[21:02:09.743][tid:00000dd0.00001c0c][INFO]             Configuration Read (REG_SZ): SOFTWARE\FSLogix\Profiles\VHDNamePattern.  Data: %username%

 

  • We will search for the file, but since this has not been found, we will create a new one.

 

[21:02:09.743][tid:00000dd0.00001c0c][INFO]             Profile VHD not found.  Creating new VHD.

:

[21:02:09.759][tid:00000dd0.00001c0c][INFO]           ===== Begin Session:   Create Formatted Disk

[21:02:09.837][tid:00000dd0.00001c0c][INFO]              Created vhd(x): \\sample.file.core.windows.net\fslogix\testuser.dev\testuser.vhd

 

  • During the second logon, we will check again if the disk exists and, because the file does not exist, we will create a new container, but it will fail with error "The File Exist".

 

[21:11:41.874][tid:00000dd0.00001da8][INFO]             Profile VHD not found.  Creating new VHD.

:

[21:11:41.890][tid:00000dd0.00001da8][INFO]           ===== Begin Session:   Create Formatted Disk

[21:11:41.890][tid:00000dd0.00001da8][ERROR:00000050]    VirtualDiskAPI::CreateFormattedDisk failed to create vhd(x): \\sample.file.core.windows.net\fslogix\testuser.dev\testuser.vhd (The file exists.)

 

How can we fix this issue? We need to understand that the values used for folder and file naming convention work in pairs, this means that, if you modify SIDDirNamePattern, you need to make sure that you set the same value for SIDDirNameMatch. If you change the value for VHDNamePattern, you need to make sure that you set either the same value for VHDNameMatch or a value that will help to find the right disk. In our scenario, the values should be changed as follows:

 

Before

After

SIDDirNameMatch: Default - %sid%_%username%

SIDDirNamePattern: %username%.%userdomain%

VHDNameMatch: Default - Profile*

VHDNamePattern: %username%

SIDDirNameMatch: %username%.%userdomain%

SIDDirNamePattern: %username%.%userdomain%

VHDNameMatch: %username%

VHDNamePattern: %username%

 

 

You might be wondering: Gonzalo, can you please clarify what you mean by “you need to make sure that you set either the same value for VHDNameMatch or a value that will help to find the right disk.”? To answer this question, let’s take a look at the default values for VHDNameMatch and VHDNamePattern. Default value for VHDNamePattern is “Profile_%username%” and for VHDNameMatch is “Profile*”. You will notice that it has an “*” at the end. By using a wildcard we are looking for any file that starts with “Profile_”. If you for example decide to modify VHDNamePattern value to “Profile_%username%.%profileversion%”, the value in VHDNameMatch will still work because both of them start with “Profile_”

 

I really hope that this blog helps you to have a better understanding about how to customize your FSLogix deployment.

Co-Authors
Version history
Last update:
‎Jul 29 2022 11:28 AM
Updated by: