Preparing a Windows 11 VM image for mass deployment with Microsoft Sysprep

2 users found this article helpful

When you distribute Windows 11 VMs to your end-users' computers, you may need to manage those VMs granularly: enroll them into domains, activate Windows licenses, differentiate PC names, enforce specific policies, enable company-wide licensing tools, etc. All that, and more, can be achieved with the help of Microsoft's own Sysprep utility. This guide explains how to prepare VMs for deployment on Parallels Desktop using MS Sysprep. You are free to selectively follow only the steps that you need to solve your particular task.


Without Sysprep, all VMs activated from the same image will look like one machine to your endpoint management system (e.g., a KMS server or a cloud-based licensing tool).




Please note that the guide for the Microsoft Cloud infrastructure solution does not apply here because Sysprep doesn't work with Azure Active Directory from Microsoft.


Please note that presently, this guide does not apply to Windows for Arm, as the process described below continues to fail with various errors. Parallels and Microsoft are working on the resolution.


How Sysprep works


Microsoft provides the Sysprep utility to generalize a Windows 11 image. Microsoft Sysprep allows you to generalize an image, which means removing the information related to a specific installation (SID, GUID, etc.) prior to deployment. You can install all required software, drivers, and security updates, predefine the default user profile in the source image and then deploy the image to user devices. In Windows 11, the Sysprep.exe utility can be found in the following directory: C:\Windows\System32\sysprep. Image generalizing allows you to ensure that Windows OS unique identification is reset, and you can deploy prepared images for lots of Chrome devices as if they were separate Windows installations on every device. Sysprep also allows you to automate a sequence of setup tasks using the so-called answer file. An answer file is an XML-based file that contains setting definitions and values to supply during the Windows setup process. In the answer file, you specify various setup options, such as computer name, licensing information, workgroup or domain settings, etc. The answer file is typically called Unattend.xml but can be named any way you like.


1. Prepare your VM setup


At this step, set up a reference VM in Parallels Desktop. Install all necessary software and make all required provisions and settings as planned. This will be your reference setup from which you prepare the installation image. It is important that you do not enroll this reference machine in the domain and do not install any Microsoft Store apps. You can find more information on how to create a virtual machine here.


2. Prepare the answer file


In case you are planning on mass-deploying the image created in Step 1 in a generalized state, you will have to prepare your own version of the answer.xml file. This will enable you to enroll freshly installed VMs in the domain, randomize their names and IDs, set up customs locales, assign cloud-based licenses correctly, and more.


Download our sample answer file here and open it in a text editor. Change the specified parameters as needed and activate the ones you plan on using by uncommenting the corresponding strings.


Uncomment the required parameter strings by removing the “<!--” sequences at the beginning and the “-->” sequences at the end of them, along with the explanations, as displayed in the image below.




Once you’re done, go to C:\Windows\Setup, create a folder named Scripts, and copy your configured answer.xml file there.


3. Clean up


The answer file contains usernames and passwords in plain text, which is not secure. However, there is a way to automatically delete the answer.xml file once the setup process is complete. Create a new file in a text editor and add one line to it:


Erase C:\Windows\Setup\Scripts\answer.xml


Save the file as setupcomplete.cmd and copy it to the C:\Windows\Setup\Scripts directory. During the setup process, before the login screen appears, Windows will automatically execute setupcomplete.cmd and erase the answer.xml file.


Make a second copy of setupcomplete.cmd, rename it to ErrorHandled.cmd, and copy it to the C:\Windows\Setup\Scripts directory. This way, the answer.xml file also gets deleted in case the setup process crashes with critical errors.


4. Run the Sysprep utility


Open the Windows Command prompt and execute the following commands:


cd  C:\Windows\System32\Sysprep


Sysprep.exe /unattend:C:\Windows\Setup\Scripts\answer.xml  /oobe /generalize /shutdown


5. Deliver the image file to end-users


To prepare a final image for your end-users, open the Parallels Desktop Control Center, select the VM where you’ve completed the steps above, right-click on it, choose the Prepare for Transfer option, and then click Continue.




Once the process is completed, right-click on the same VM and select Show in Finder to locate the resulting image.



The deployment can be performed either through a pkg package via your MDM provider of choice (see this KB article) or as a configuration profile payload using the administrator’s access to the Parallels My Access control panel (find more information here).

Was this article helpful?

Tell us how we can improve it.