Tag: Sysprep

sysprep.exe vm mode

Windows Sysprep for Virtual Machines

For using the same system image for different virtual machines or physical computer, Microsoft created a tool called sysprep.exe. This blog post covers Most people should be already familiar with that tool. If not here is the description:

Sysprep prepares a Windows installation (Windows client and Windows Server) for imaging, allowing you to capture a customized installation. Sysprep removes PC-specific information from a Windows installation, “generalizing” the installation so it can be reused on different PCs. With Sysprep you can configre the PC to boot to audit mode, where you can make additional changes or updates to your image. Or, you can configure Windows to boot to the Out-of-Box Experience (OOBE).

This is great so you can sysprep a virtual machine copy the VHD or VHDX file and use it for the first boot of different VMs. In Windows Server 2012 and Windows 8, Microsoft added an addition to sysprep called the mode switch “/mode:vm”. The mode:vm switch allows you to identify the Windows as a Virtual Machine and sysprep.exe will generalize a Virtual Hard Disk (VHD or VHDX) so that you can deploy the VHD as a VHD on the same Virtual Machine (VM) or hypervisor. You must deploy the VHD on a Virtual Machine (VM) or hypervisor with the same hardware profile. For example, if you created VHD in Microsoft Hyper-V, you can only deploy your VHD to Microsoft Hyper-V VMs with a matching hardware profile, and you can only run VM mode from inside a VM.

This will boost the performance and time for the virtual machine for the first startup and installation. This also work of course with virtual machines running on other hypervisors such as VMware or Xen.

Run the following command inside the Virtual Machine (You find sysprep.exe in the  C:\Windows\System32\Sysprep folder):

 
sysprep.exe /oobe /generalize /shutdown /mode:vm

Now you can copy the VHD or VHDX file from that virtual machine and use it for other VMs. Also check out my post about automating VM creation using an unattend.xml file.



Create an OS Image in Windows Deployment Services (Capture Image)

Here I will show you how you can simply create a new Image in WDS (Windows Deployment Services). You can use this to create own Images for your Servers or PCs or update existing Images.

  1. Add Capture Images to your WDS
    Windows Deployment Services
  2. Update your Computer or VM with the latest Software.
    Windows Deployment Services
  3. Use Sysprep to generalize the Machine. You can find sysprep.exe in C:\Windows\System32\sysprep
    Sysprep
  4. After the Reboot boot into PXE and boot the Windows Capture Image
    Capture Image
  5. Now you can use the Image Capture Wizard
    Capture Image Wizard
  6. Choose which volume you want to capture if you have just one partion in your installed Image the Volume would be D:\ (C: is the booted Windows PE from the Windows Deployment Service)
    Capture Volume
  7. Now you have to choose the name of the WIM file and the location, before you can upload it to the WDS Server you have to save it on a local partion. After that you can choose your WDS Server and the Image Group you want to upload the image after the Volume is captured.
    Image
  8. Now the capturing process will start
  9. After the capturing process is finished and the image is uploaded you can find the Image in the Image group on your WDS Server
    Capture ImageWDS
  10. Now you can Rollout this new Image