Follow

How To Make APPDATA and LOCALAPPDATA Environment Variables Follow The Registry Keys

Product: ProfileUnity          

Product Version: Any

Expires on: 365 days from publish date

Updated: September 12, 2014

 

Problem:

Customer has a program that requires the APPDATA and LOCALAPPDATA environment variables to match the ones specified in the Windows registry in order to work properly.

The AppData and Local AppData registry values in HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders (see below) are sufficient for most Windows programs. These values follow the Folder Redirection Settings.

reg_keys.png

(This article assumes you are using Folder Redirection to point the user's AppData and LocalAppData folders to a mapped drive. In this article that drive is mapped to H:\. Substitute your home drive letter if it is different.)

Occasionally one will come across a program that follows the environment variables visible using the SET command. This article shows how to configure the base image to correct this behavior.

This fix works for desktops managed using VMware View, XenDesktop, and other VDI solutions, as well as sysprepped templates prepared beforehand. 

 

Resolution (VMware View, XenDesktop, and other VDI solutions)

1. Log on to the base image as administrator. (Create a snapshot first if necessary).

2. Open a command prompt (Start, Run, CMD) and run the following command:

REG LOAD HKU\DefaultUser %SystemDrive%\Users\Default\NTUSER.DAT

3. Open Regedit (Start, Run, Regedit)

4. Edit these keys:

HKEY_USERS\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

Set AppData to H:\Appdata\Roaming.

HKEY_USERS\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

Set Local AppData to H:\Appdata\Local

5. Close Regedit.

6. Switch back to the CMD window and run the following command:

REG UNLOAD HKU\DefaultUser

7. Recompose pool (VMware View) or update catalog (XenDesktop).

8. Log in as a test user. Open a command prompt and run the SET command. You should see APPDATA and LOCALAPPDATA set to map to the home drive location.

cmd.PNG

 

Resolution (Sysprepped templates):

1. Log in as Administrator and configure the desktop as you desire.

2. Follow steps 2-6 in the instructions above to put the appropriate registry keys in place.

3. Follow 'Step 2: Create an Unattend.xml file that contains the Copy Profile parameter' in the Microsoft KB article referenced aboveNote: The answer file you create must contain the CopyProfile parameter. This will ensure that the registry settings you have made above will be copied to the default profile.

4. Follow the rest of the Microsoft KB article to finish, test, and seal the image for deployment. Any time the image is deployed, you should see the results follow the image in Step 8 above.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Article is closed for comments.