Suppose our example user Jennifer Hansen changes her last name to Smith. Her username is jhansen, and her home directory settings point to the H drive on a local file server. She also has a roaming profile on the local file server. Her home and profile folders are both in her name (i.e., Jennifer Hansen). To use Cusrmgr to change her account information (e.g., to change her username to jsmith), use the following command-line syntax:
cusrmgr -u jhansen -m \\pdcserver -r jsmith -f "Jennifer Smith" -U \\fileserver\profiles$\jsmith -H H -h \\fileserver\jsmith$
The -u switch specifies the current username. The —m switch specifies the machine on which you want to modify the accounts database. (You can omit the —m switch if you want Cusrmgr to default to the local computer.) The -r switch provides the new username. The -f switch replaces the Full Name. The -U switch redefines the profile path, and the -h switch redefines the home directory path.
The switches are case sensitive, and you must put quotation marks around any parameters that contain spaces. Because you're only renaming the account, the user retains all NTFS permissions you assigned; permissions you assigned to Microsoft Exchange Server mailboxes also remain unchanged. Windows NT cares about only the SID associated with the account, and the SID for jhansen doesn't change when you change the username to jsmith.
To wrap Cusrmgr into a batch script with parameters, simply type
changeuser.bat jhansen jsmith Jennifer Smith
Think about the time and effort this tool can save on routine administrative tasks. For a list of Cusrmgr switches and their usage, see the Microsoft Windows 2000 Server Resource Kit's online Help.