Subscribe to Windows IT Pro
September 10, 2002 12:00 AM

Copying Win2K PC Profiles

Quickly move multiple user profiles from one Win2K PC to another
Windows IT Pro
InstantDoc ID #26356
Rating: (0)
Downloads
26356.zip

Script Components
To run the script, you need the KiXtart and Robocopy resource kit utilities. You also need to download the following script files from the 26356.zip file at http://www.winscriptingsolutions.com, InstantDoc ID 26356:

  • Savepc.bat, which Listing 1 shows, calls savepc.vbs.
  • Savepc.vbs, which Listing 2 shows, writes the old PC's SID and other information to a three-line ASCII file, then calls savepc.kix.
  • Savepc.kix, which Listing 3 shows, writes the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList registry subkey and its security settings to a file.
  • Copypc.bat, which Listing 4 shows, copies the C:\documents and settings folder from the old PC, then calls copypc.kix and copypc.vbs. Copypc.kix must be called before copypc.vbs.
  • Copypc.kix, which Listing 5 shows, overwrites the new PC's profile list with the old PC's list.
  • Copypc.vbs, which Listing 6 shows, scans for and deletes SIDs that were specific to the old PC (which copypc.kix imported along with the domain profiles to the new PC). Copypc.vbs then deletes the C:\documents and settings\administrator folder.
  • Running the Script
    Now, you're ready to give the script a try. This part is easy. Place all the KiXtart, Robocopy, Save, and Copy files in a network folder. Then, to copy the user profiles from an old PC to a new one, complete the following steps:

  1. Prepare a new PC for use and make it ready to log on to the domain. Be sure to give it a name different from the old PC because both PCs must be on the network when you're copying from the old to the new. (After you've completed the copy, you can remove the old PC from the network and rename the new PC, if you like.)
  2. Use any domain account that has administrator privileges to log on to the old PC.
  3. On the old PC, click Start, Run and type the path to the savepc.bat file (e.g., C:\copyprofiles\savepc.bat).
  4. When savepc.bat is finished (after 3 to 5 seconds), restart the old PC and leave it at the logon prompt (you'll be tempted to skip the restart and just log off, but doing so leaves some profile files open and therefore uncopyable, so be sure to restart).
  5. Log on to the new PC with Domain Administrator privileges; click Start, Run and type the path to the copypc.bat file and the name of the old PC (e.g., C:\copyprofiles\copypc.bat oldpc).

Wait while the script completes the copying. The time required will vary depending on the number and size of the profiles on the old PC. When the copying is finished, the script opens Windows Explorer on the new PC and sends keystrokes to delete the C:\documents and settings\administrator folder. (Although I have full permissions to the C:\documents and settings\administrator folder and wasn't logged on as the administrator, I couldn't make VBScript delete the folder. The Deletefolder method reported success, but the folder remained in place.)

Wait until the folder has been deleted before doing anything. You might want to keep the old PC around a while (i.e., don't redeploy or dispose of it right away) in case you run into problems later with the copied information.

After the copying is finished, you might not be able to turn off the new PC by clicking Start, Shut Down. Press Ctrl+Alt+Del and select Shut Down from the Win2K Security menu.

Like usmt.exe, the script copies printer mappings and application shortcuts but doesn't copy printer drivers or other applications. You must reinstall your applications on the new PC.

To improve this script, you could add code that restarts the old PC after savepc.bat runs. Likewise, you could add code that shuts down or restarts the new PC after the copying is finished. You could also use the free PsExec utility, which you can download from the Sysinternals Web site at http://www.sysinternals.com/ntw2k/freeware/psexec.shtml, to perform all the steps from the destination PC.

Although my script isn't pretty, it does a sound job of copying user profiles and their settings directly from one Win2K PC to another. When used within a structured migration process, this automation technique is a real time-saver.

Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.