Article ID: 195950
Article Last Modified on 11/1/2006
%SystemRoot%\Profiles\%USERNAME%This value is referred to as %HOMEDRIVE%%HOMEPATH%. If Terminal Server is installed to drive C in the default directory \WTSRV, when a user (UserA) logs on who does not have a Home Directory specified in User Manager, his or her home directory will be C:\Wtsrv\Profiles\UserA. This can be seen by typing SET at a command prompt:
HOMEDRIVE=C: HOMEPATH=\WTSRV\PROFILES\UserAWhen a user who has a Home Directory or Terminal Server Home Directory specified in User Manager (Connect X: \\Server\Share\UserA) logs on, the following information is seen when typing SET at a command prompt:
HOMEDRIVE=X: HOMEPATH=\UserAAlthough this is the logical place to store a user's files, there needs to be a way to address this unique path for all users in the registry. The registry entry for the User's documents path in ApplicationA is:
HKEY_CURRENT_USER\Software\CompanyA\ApplicationA\DefaultPathThe value of the path cannot be set to %HOMEDRIVE%%HOMEPATH%. Likewise, the value cannot be X:\%USERNAME%. ApplicationA does not understand either of these entries. To work around this issue, ROOTDRIVE is used.
REM REM Before running this application compatibility script, you must REM designate a drive letter to be mapped to each user's home REM directory. Update the "Set RootDrive" statement at the end of REM this file to indicate the desired drive letter. If you have REM no preference, the drive W: is suggested. For example: REM REM Set RootDrive=W: REM REM Note: Make sure there are no spaces after the drive letter and REM colon. REM REM When you have completed this task, save this file and exit REM NotePad to continue running the application compatibility script. REM Set RootDrive=The installer is required to select a drive letter. Any drive letter may be chosen, but it is important that it not be the drive letter specified in User Manager for either the Home Directory or Terminal Server Home Directory (in this example, X was used for UserA's home directory). Furthermore, the installer should not choose a drive letter that is used in a logon script. In this scenario, the person installing ApplicationA decides to use the suggested drive letter W:.
HKEY_CURRENT_USER\Software\CompanyA\ApplicationA\DefaultPathis now set to W:\, because this is the drive letter chosen to be ROOTDRIVE. The easiest way to think of this is ROOTDRIVE = %HOMEDRIVE%%HOMEPATH%. When UserA logs in, his or her drive W = \\Server\Share\UserA. When UserB logs in, his or her drive W = C:\WTSRV\PROFILES\UserB, because he or she does not have a home directory specified in User Manager. When UserA starts ApplicationA, he or she stores all of his or her documents in drive W, as does UserB. Both users' documents, however, are in different places, which is the original issue that needed to be addressed.
HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion \Winlogon\AppsetupNOTE: The above registry key is one path; it has been wrapped for readability.
Rem Rem Map the User's Home Directory to a Drive Letter Rem Net Use %RootDrive% /D >NUL: 2>&1 Subst %RootDrive% /d >NUL: 2>&1 Subst %RootDrive% %HomeDrive%%HomePath%The first line is a NET USE statement that deletes any drive letter that currently exists that is using the drive letter that was chosen for ROOTDRIVE. The second line is a SUBST command with a /d switch that deletes any substituted drive you have that has the same letter as the drive letter that was chosen for ROOTDRIVE. Finally, the third line runs the SUBST command for %HOMEDRIVE%%HOMEPATH% with the drive letter that was chosen for ROOTDRIVE.
Keywords: kbinfo KB195950