Share via


Sysprepping a virtual machine

I learned how to do this at TechEd 2004 in a lab led by Robert Larson, one of our resident Virtual Server gurus.

You can create a “base” virtual machine with the operating system and applications you want, and then copy its .vhd file to use for other virtual machines. When you do this, it’s important to run a tool called Sysprep on the base virtual machine. That way, when you start a virtual machine that uses a copy of the base virtual machine’s .vhd file, the guest operating system will be assigned a new SID, GUID, MAC address, and so forth when it starts up. This way you won’t end up with network conflicts between different virtual machines that use the same copied .vhd file.

Important Notes:

  • Do not perform this procedure on the host computer!! Perform it only within the guest operating system of the virtual machine you want to clone.
  • Microsoft does not support using a tool other than Sysprep for cloning virtual machines. For more information, see this Knowledge Base article: https://support.microsoft.com/Default.aspx?id=162001.

Step 1: Install the Setup Manager files in your guest operating system

  1. Set up a base virtual machine by installing the operating system, service pack, patches, applications, and so forth that you want to clone.
  2. Start the guest operating system and log on as a local administrator.
  3. From the guest operating system, go to the Microsoft Web site and download the appropriate Sysprep version. Extract the files to a folder such as C:\Tools on the guest hard disk. You can obtain the SysPrep files from the following locations:
    Windows 2000:  https://www.microsoft.com/windows2000/downloads/tools/sysprep/default.asp
    Windows XP:  https://www.microsoft.com/downloads/details.aspx?FamilyID=7a83123d-507b-4095-9d9d-0a195f7b5f69&DisplayLang=en
    Windows XP SP2 and Windows Server 2003:  https://www.microsoft.com/downloads/details.aspx?FamilyID=3e90dc91-ac56-4665-949b-beda3080e0f6&displaylang=en&Hash=RWRPDM9

Step 2: Create an answer file

Note: This procedure applies to the Sysprep version for Windows Server 2003. You’ll need to modify the steps for other versions of Sysprep. The files that you extracted from the Microsoft Web site include a help file named Deploy.chm that has specific information for your version. It's a good idea to read the help file and become familiar with this tool and figure out how to customize the following steps for your own environment and purposes.

  1. In the Tools folder on the local disk of the guest operating system, double click Setupmgr.exe to start the Setup Manager wizard.
  2. Click "Next."
  3. Select "Create New" and click "Next."
  4. Select "Sysprep Setup" and click "Next."
  5. Select the type of guest operating system and click "Next."
  6. Select "Yes – Fully automate the installation" and click "Next."
  7. Type a name and organization, click "Next."
  8. Accept the default display settings by clicking "Next."
  9. Select your home time zone and click "Next."
  10. In Product Key type the product key and click "Next."
  11. In licensing, select the type of license for the guest operating system, and click "Next."
  12. Type a computer name for the guest operating system and click "Next."
  13. Set the administrator password and click "Next."
  14. To ensure that the password will be set, the machine’s password must be blank.  Press Right-ALT + DEL and click "Change Password." Type the old password and leave the new password blank. Click "OK."
  15. Select "Typical Settings" and click "Next."
  16. Leave the machine in a workgroup and click "Next."
  17. Customize the next few screens of additional settings as necessary. If you don't know what they're for, accept the defaults.
  18. In "Identification String" type the computer name and click "Finish."
  19. Specify C:\Tools\Sysprep\sysprep.inf for the location for the .inf file.
  20. Click "Cancel" to close the Setup Manager wizard.
  21. You now have a C:\sysprep folder with your sysprep file and copy stored at C:\tools\sysprep\sysprep.inf.  
    Copy Sysprep.exe and Setupcl.exe from C:\Tools\Sysprep to C:\Sysprep.

Step 3 – Sysprep the guest operating system

  1. Close all windows in the guest operating system.
  2. Click "Start" and then "Run."
  3. Type C:\sysprep\sysprep.exe and press Enter. 
  4. This starts the Sysprep process. Click "OK" to clear the warning dialog.
  5. Select "Do not reset grace period for activation."
  6. Make sure that the shutdown mode is "Shutdown."
  7. Click "Reseal."
  8. When prompted about regenerating SIDS, click "OK." The guest operating system will be Sysprepd and will automatically shut down.
  9. Remove the base .vhd file from the virtual machine, and in the file system, make the base.vhd file read-only. You need to do this because you do not want to start a virtual machine by using this base .vhd file. If you do, it will undo the whole process that you just went through.

You can now make copies of this .vhd file and attach them to different virtual machines. After you copy the .vhd file, you need to remove the copy’s read-only attribute. When you start a virtual machine with a copied .vhd file, it will receive a unique SID and other identifiers. You can also use the base .vhd file as the parent drive image for several differencing drives. The unique identifiers for each guest operating system built in this way will thus be written into the differencing drives, and not the parent.

Note: The fourth time you run Sysprep on the same media, you receive the message, "Your grace period limit has been reached and will not be reset." For more information, see https://support.microsoft.com/default.aspx?scid=299840.

Comments

  • Anonymous
    January 01, 2003
    Here are a few valuable links that I've collected in deploying Virtual Server:
    Deployment
    Ways to deploy...
  • Anonymous
    January 01, 2003
    Here are a few valuable links that I've collected in deploying Virtual Server:
    Deployment
    Ways to deploy...
  • Anonymous
    January 01, 2003
    Virtual PC SourceSafe Network Problem
  • Anonymous
    January 01, 2003
    Where Virtual Server doesn't like bad memory.
  • Anonymous
    January 01, 2003
    One of the joys of virtualisation is the flexibility afforded by the ability to copy virtual machine...
  • Anonymous
    January 01, 2003
    Here are a few valuable links that I've collected in deploying Virtual Server:
    Deployment
    Ways to deploy...
  • Anonymous
    January 01, 2003
    Here are a few valuable links that I've collected in deploying Virtual Server:
    Deployment
    Ways to deploy...
  • Anonymous
    January 01, 2003
    I was reading TeckTalkBlogs, and I saw a post on problem with cloned Virtual Machines and Microsoft Distributed...
  • Anonymous
    January 01, 2003
    Steve Lamb has posted a little gem about SysPrep and Virtual Machines.  I know I've mentioned (and...
  • Anonymous
    January 01, 2003
    All these while, whenever I want to have a new virtual machine to test stuff, I simply duplicate the...
  • Anonymous
    January 01, 2003
    Here are a few valuable links that I've collected in deploying Virtual Server:
    Deployment
    Ways to deploy...
  • Anonymous
    January 01, 2003
    Here are a few valuable links that I've collected in deploying Virtual Server:
    Deployment
    Ways to deploy...
  • Anonymous
    January 01, 2003
    Here are a few valuable links that I've collected in deploying Virtual Server:
    Deployment
    Ways to deploy...
  • Anonymous
    January 01, 2003
    Instructions on how to sysprep your virtual machine images. I wish I had done this the first time. :...
  • Anonymous
    January 01, 2003
    Q: Haileyesus asks, "How do you increase the size of a virtual hard disk?"
    A: Unfortunately, Haileyesus,...
  • Anonymous
    January 01, 2003
    Here are a few valuable links that I've collected in deploying Virtual Server:
    Deployment
    Ways to deploy...
  • Anonymous
    January 01, 2003
    When working with virtual machines, it is very helpful to run SysPrep on the operating system that you want to clone. This way, the guest operating system receives a unique GUID and MAC address when they start up. Otherwise, you...