Sysprep: Unattended Configuration to Extend OS Partition
In this article, we will discuss how to use Sysprep with an unattend file to extend the OS partition during the deployment process. The goal is to automate the process of extending the system partition, making it easier to manage and deploy virtual machines (VMs) in an enterprise environment.
What is Sysprep and why use it?
Sysprep (System Preparation Tool) is a utility in Windows that helps you to install a single image of Windows on multiple computers. It removes system-specific information from a Windows installation, allowing you to create a generalized image that can be deployed on different machines. By using an unattend file, you can automate the configuration process, reducing manual intervention and errors.
Preparing the unattend file
To extend the OS partition during the deployment process, you need to create or modify an unattend file (.xml) with the following content:
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="specialize">
<component name="Microsoft-Windows-Setup">
<SystemPartition>
<Extend>true</Extend>
</SystemPartition>
</component>
</settings>
</unattend>
This unattend file will automatically extend the system partition during the deployment process. Make sure to save this file as unattend.xml in the C:\Windows\System32\Sysprep directory.
Running Sysprep with the unattend file
To run Sysprep with the unattend file, open a command prompt as an administrator and navigate to the C:\Windows\System32\Sysprep directory. Run the following command:
Sysprep.exe /generalize /oobe /quit /mode:vm /unattend:unattend.xml
Here's a breakdown of the command:
/generalize: Removes system-specific information from the Windows installation./oobe: Configures the system to start the Out-Of-Box Experience (OOBE) after the next reboot./quit: Forces Sysprep to exit after generalizing the Windows installation./mode:vm: Specifies that the Windows installation is running on a VM./unattend:unattend.xml: Applies the unattend file to extend the OS partition during the deployment process.
By using Sysprep with an unattend file, you can automate the process of extending the OS partition during the deployment of Windows VMs. This approach helps reduce manual intervention and errors, making it easier to manage and deploy Windows systems in an enterprise environment.
References
- Microsoft Docs: Sysprep overview
- Microsoft Docs: Generalize a Windows installation
- Microsoft Docs: Specialize a Windows installation