Wednesday, November 5, 2008

Clone Your Windows Virtual PC using Sysprep

You have users who utilize Microsoft Virtual PC. You have a standard Windows image. You want to ease the administrative overhead of distributing the image.

The goal here is to have a .vhd file that you can place in a read-only share on your network that your users can use with the least amount of work for you or your user. You must not have conflicting SIDs on the network, and cannot have conflicting computer names. Sysprep is your answer.

Microsoft includes Sysprep on the Windows XP cd. Learning to effectively use this tool will free up your time so you can do something more important (like check out that episode of 'The Office' you missed).

1. Extract the Sysprep tool
Explore your Windows XP CD to the \Support\Tools directory. There you will find a file called deploy.cab. You can double-click on that file, select all files, right-click and choose 'Extract'. You will be able to specify a location for the files. For now, place them in a working directory. You will copy them to the target machine shortly.

2. Create the sysprep.inf file
Run setupmgr.exe, which is a wizard-based application that will create your answer file. If you don't create an answer file, you will have to manually enter the cd key, computer, name, etc. the first time you boot your imaged computer.

3. Copy Sysprep files to your target machine
The Windows system directory needs to have a folder named sysprep in order for the entire process to work. The Windows directory is c:\Windows by default. However, confirm that is consistent with your machine. Copy the following files (the ones you extracted in step 1) to the c:\windows\sysprep folder you just created:
sysprep.exe
setupcl.exe
sysprep.inf
(created in step 2)

4. Sysprep the target machine
Now you're ready for the fun part. Open a command prompt and navigate to your sysprep directory (probably c:\windows\sysprep). You may want to run the following command to familiarize yourself with the different options of sysprep:

sysprep.exe /?


This will display the list of switches available to you. Normally you would not need any of these except for the -noreboot option. This will keep the machine from rebooting when you are done with the Sysprep process. Run the following command:

sysprep.exe -noreboot

Choose the options that suit your needs. The default settings will be sufficient for most users. This process prepares your Virtual PC for cloning. Once this process is complete, your PC will shut down. Now you have your master image.

5. Distribute your cloned .vhd file
Place your .vhd file in a read-only shared directory on your network. This way you can allow access to the file without the risk of someone messing the image up. Your users can copy the file to their physical PC to use it in Virtual PC.

6. Create your new Virtual PC using the cloned .vhd file
Open Virtual PC. Click 'New' to create a new machine. Follow the wizard to create a virtual machine. When you reach the 'Virtual Hard Disk Options' screen, select to use an existing virtual hard disk. Browse to your local copy of the cloned .vhd file.

When you boot the virtual pc the first time, it will access your sysprep.inf file to complete the mini setup. This will require no intervention by you or your users. Now go get that cup of coffee, settle in and watch your 'The Office' episode from last week.

No comments: