When working with Virtual Machines, Sysprep is a real timesaver. You can, on a virtual machine, install several configurations of servers (SMS 2003, SQL or SCCM or vNext, etc), sysprep the images, and then have these pre-configured images ready to deploy to a VPC or any Vcenter installation when needed, by just copying the appropriate VHD file over and associating it with a new VM.
In order to run Sysprep, you first need to install it. You can get a hold of Sysprep in two ways: it is on the \Support\Tools\Deploy.cab file on the Windows Server installation media, or you can download it from here. Once you get a hold of the Deploy.cab file, you should extract the contents to a directory on your HD, for example c:\Deploy.
This directory contains several useful tools, and you should definitely read the deploy.chm file for instructions and details on the process. There are two files that are of particular importance to the process: sysprep.exe and setupmgr.exe.
For sysprep to work completely automated, it requires an answer file, called sysprep.inf. This answer file contains the “answers” to all the questions asked by the Windows installer during the setup process. The answer file can be created manually with any text editor, but fortunately there is a nice wizard-like tool that can help you generate this file. This tool is the setupmgr.exe program:
This program allows you to generate the sysprep.inf file by presenting you the options and letting you enter the default answer. In order to fully automate an installation, follow these steps on the Setup Manager:
- Click Next on the Welcome screen
- Select “Create new” and click “Next”
- Select “Sysprep setup” and click “Next”:
- Select the type of system you’re going to sysprep, and click “Next”
- Select “Yes, fully automate the installation” and click “Next”
- Now you need to fill in all the information required to complete the process:
Once you complete the execution of the Setup Manager, it creates a new directory in the root of the system drive called sysprep. This directory contains all the information necessary for the Sysprep tool to execute.
Now you need to execute the Sysprep tool, sysprep.exe:
In this tool:
- Click “OK” on the warning dialog that appears when running the tool.
- Select “Don’t reset grace period for activation”
- Set the “Shutdown mode” to “Shut down”
- Click on Reseal. That will leave the image ready for copying.
After a little while (<10min), the machine will reboot, and the process will be completed. You now have a brand new sysprep’d and cloned server up and running!!
For Windows XP SP3 :-
The first step is to download the Sysprep App which is included in the CAB file for Windows XP Service Pack 3 Deployment Tools. (Download Sysprep Tool)
Next go to the PC you are going to be sysprepping and create a folder on the root of the C: drive called sysprep.
Next you will need to extract the contents of the deploy.cab file you downloaded in Step #1 to the sysprep folder on the root of the C: drive.
Now we are going to run the sysprep Setup Manager. Double click on setupmgr.exe.
Sysprep Setup Manager
Click Next and it is going to ask you whether you want to modify an existing Answer File or create a new one. We are wanting to create a new one, so again click next.
Sysprep - New or Existing Answer File
You now have three options: Unattended Setup, Sysprep Setup, or Remote Installation Services (RIS). In this example we are going to select the Sysprep setup option and then click next. (This creates a sysprep.inf file)
Sysprep - Sysprep.inf File
Select Windows XP Professional and click next. (This will also work on Windows XP Home, Windows Server 2003 Standard, Web, and Enterprise.)
Sysprep - Windows XP Professional
In this step it is asking you if you want to fully automate the installation. That is up to you, either way works fine. In this example I will be using the “No, do not fully automate the installation.”
Sysprep - Fully Automate or Not?
Now we are at the configuration page. There is a lot in here so I am not going to go into detail. In fact, you don’t even need to input anything here for the sysprep to just work. However, everything you input in here will save you time and help shape your image.
Sysprep - Configuration Page
Once you are all done, you should be at the bottom and selected on “Identification String”; click Finish and it is going to prompt you for a location to create and save the sysprep.inf file. The default location is fine, as it will need to be within that sysprep folder on your C: drive. Once you hit ok you will then need to click “Cancel”. There is no close button.
Sysprep - Saving the Sysprep.inf File
Now you should verify the sysprep.inf file by double clicking on it and opening it up with Notepad.
Sysprep - Verifying the Sysprep.inf File
There were a few changes with Windows XP Service Pack 3 and sysprep. The administrator’s profile is no longer copied over to the default profile. You will need to add a line within the sysprep.inf file to regain this important function. Under the InstallFilesPath section add this:
Once done, hit save.
Sysprep - Adding line to sysprep.inf so the administrator profile will copy over to default profile
Now you are ready to start the sysprep, reboot, and capture your sysprepped image. Double click on the sysprep.exe and then select the following three options in order: Use Mini-Setup, Shutdown Mode: Reboot, and click Reseal. Make sure you have your media ready to capture your image. If you reboot fully without booting to your capturing software it will ruin the sysprep and you will have to redo the sysprep.
Sysprep - Preparation Tool 2.0
For Windows Vista / 7 / 2008
Type this command with administrative privileges in command prompt
c:\windows\system32\sysprep\sysprep.exe /quiet /generalize /shutdown /oobe
The experience is also streamlined considerably. Simply run sysprep.exe above and you are presented with:
Check the “Generalize” checkbox (regenerates system SID), change the Shutdown Options to “Shutdown”, and click OK. The system will go through the sysprep process and shut itself down.
Using Your SysPrep’d Image to Create a New Virtual Machine
Now, creating a new virtual machine will only take just a couple minutes.
- First, you need to copy your SysPrep’d image to a new name and to a new location where you will use this new virtual machine. Copy your SysPrep’d image files (.vmc & .vhd) to a new location where you want your new virtual machine file to reside.
- Rename them to a new, appropriate name. For example, if you are going to create a SharePoint server you might name them something like:
- Add this new virtual machine to you Virtual PC or Virtual Server; which ever you are using;
- Edit the configuration and make sure the virtual hard drive (VHD) is pointing to your new .vhd file. In this example, the MySharePoint2007.vhd file.
- Configure any other items such as memory allocation and network cards as necessary.
- Start the virtual machine.
- You will receive a few prompts such as the name for you new machine.
- If you wish, you can now join you virtual machine to a domain.
SysPrep is a must have time-saving tool for anyone who uses Virtual PC and/or Virtual Server.