Sysprep a Windows Server 2012 R2 VHD

When creating a new virtual SharePoint farm, several servers will be required in most cases:

  • AD – if the farm is in a lab or is in a completely greenfield environment
  • SQL – Not essential in a research/development environment, but usually essential in most other environments
  • SharePoint – At least one SharePoint machine will be required and depending on the environment and scale, multiple machines will be required
  • Office Web Apps – Not essential but often required
  • Workflow Manager – Again, not essential but often required

A simple but essential step when creating a new VM is to install the operating system.  In most cases, this is a step that is identical in the build for each VM.

This step can be bypassed very easily by installing the OS on a VM and then using the sysprep tool to generalise the settings to allow the VHD to be copied and used in new VMs.

The steps are very straightforward:

  1. Create a new VM
  2. Install the OS
  3. Log into the VM
  4. Open a command prompt as an administrator
  5. Change to %WINDIR%System32sysprep directory
  6. Run the following command sysprep /generalize /oobe /mode:vm

The command will run and the VM will shut down.  After this the VHD can be copied and a new VM can be created with the copied VHD.

When the VM is started for the first time the following screen will be displayed:

image

For more information on sysprep see http://technet.microsoft.com/en-us/library/hh825033.aspx

Leave a Reply

Your email address will not be published.