Changing the User Profile Folder After Renaming the User

Murat Yildirimoglu, 2 April 2005

 

 

When you just rename a user (for example, the user leaves the company and a new worker is hired, and you just rename the former user account to preserve the group membership and rights the former user had) the profile folder remains the same and sometimes it confuses people. But you can correct this issue easily.

 

The user profiles are stored under \Documents and Settings folder. A folder is created under that folder for each user who logged on to that computer. A key is also created in the Registry, under the the HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList. The name of the key is Security ID (SID) of the user. Under that key there is a value named, ProfileImagePath. This value stores the address of the user profile.

 

For example, when user John logged on to a computer, a folder named john is created under the \Documents and settings folder. Also, a key named after the SID of the John, is created under HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList in the Registry. And the ProfileImagePath value data is something like that: %systemdrive%\Documents and Settings\John.

 

You can rename John, for example to be Smith. When Smith logged on to the computer, his profile folder is again \Documents and Settings\John, not %\Documents and Settings\Smith because the registry was queried for the SID of the user (and this didn't change), and whenever the SID was found under HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList, the ProfileImagePath value data is retrieved to find the user profile path and this path corresponds to the \Documents and Settings\John folder.

 

To change the profile folder to reflect the new user name you must complete the following steps:

 

1) Rename \Documents and Settings\John folder to be \Documents and Settings\Smith.

2) Find the SID of Smith using DSGET command. Assuming that Smith is under the Accounting organizational unit in domain anadolu.com, the command is like this:

dsget user "cn=smith,ou=accounting,dc=anadolu,dc=com"  -sid

and note the SID in the output of the command.

3) Start the Registry Editor and switch to the HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList. Find the SID under that key. When you find the key, edit the ProfileImagePath value to reflect the new folder name. For example, %systemdrive%\Documents and Settings\Smith.

 

Murat Yildirimoglu