Menu

Virtual Geek

Tales from real IT system administrators world and non-production environment

Create and capture Microsoft Windows server Sysprep template image

I had a project where I wanted to deliver few Microsoft Windows images to the customer. After several meeting they wanted this templates to sysprep 'ed. 

What is Sysprep?

Sysprep is a tool/utility provided by Microsoft (System Preparation) that makes a Windows client or Windows Server prepared for imaging. Sysprep can get rid of PC-specific information from a Windows installation (generalizing) so it can be installed on various Systems. Once you execute Sysprep you can set up whether the System will boot to the Out-of-Box Experience (OOBE) or audit mode. 

There are few features of Sysprep, it eliminates computer specific data from the Windows template image, containing the PC's security identifier (SID). This permits you to capture the image and use it on different computers. This is commonly known as generalizing the PC. This utility uninstalls, but doesn't delete, PC-specific drivers from the Windows image. Creates the computer for distribution to a consumer by adjusting the PC to boot to OOBE. This will let you add answer file (unattend) configuration to an existing installation.

Audit mode permits you to do the extra modifications to the Windows setting up before you deliver the pc to a consumer or capture the image for recycle in your company.

An Out-of-box experience (OOBE) is the feel a consumer has while getting a product when unboxing, or for digital delivery, runs the installer, and is planning to use it for first time, as deferred to the point-of-sale practice or the communication experience of an expert user. 

This is good option for VDI solution and when images need to be exported on cloud for IAAS solution.

Sysprep.exe is located on Windows OS under folder C:\Windows\System32\Sysprep\sysprep.exe, You can manually Generalize the OS. Once the operating system boot up, many of the information you will need to provide manually such as Password.

Note: For testing sysprep tool, Do not run sysprep on any prod system or on your laptop/pc, Test it on only Test systems.

Vmware vSPhere vCenter ESXi server vcsa vmca system preparation tools sysprep system32 virtual machines vm generilization oobe audit mode shutdown restart sid generlize.jpg

To automate the sysprep, I have this unattended xml file which I will supply in the sysprep. Which will help to automate most of the stuff and will not ask any input from customers after delivery after system boot up. Save file to unattend.xml file.

Download this sysprep script unattend.xml here or it is also available on github.com/janviudapi

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="specialize">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <ShowWindowsLive>false</ShowWindowsLive>
            <TimeZone>Central Standard Time</TimeZone>
        </component>
        <component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <SkipAutoActivation>true</SkipAutoActivation>
        </component>
        <component name="Microsoft-Windows-SQMApi" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <CEIPEnabled>0</CEIPEnabled>
        </component>
    </settings>
    <settings pass="oobeSystem">
        <component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <InputLocale>en-US</InputLocale>
            <SystemLocale>en-US</SystemLocale>
            <UILanguage>en-US</UILanguage>
            <UserLocale>en-US</UserLocale>
        </component>
            <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <UserAccounts>
                <AdministratorPassword>
                    <Value>YourPassword</Value>
                    <PlainText>true</PlainText>
                </AdministratorPassword>
            </UserAccounts>			
            <OOBE>
                <HideEULAPage>true</HideEULAPage>
		     <NetworkLocation>Work</NetworkLocation>
            </OOBE>
        </component>
    </settings>
</unattend>

Use unattend.xml file with below command to generalize and create oobe image. Once the task completes it will shutdown the system. Do not power on the system. This image will be prepared and ready to use on systems or provide to consumers directly.

C:\Windows\System32\Sysprep\sysprep /oobe /generalize /shutdown /unattend:C:\temp\unattend.xml

Useful Articles
Using terraform to clone a virtual machine on VMware vSphere infrastructure
Terraform module clone VMware vSphere Linux and Windows virtual machine
Terraform VMware vSphere Virtual Machine customization clone failed on Windows
Terraform VMware vSphere Virtual Machine cloning Operating system not found
docker: Got permission denied while trying to connect to the Docker daemon socket
Ansible AWX Tower create Manual SCM (Source Control Credential Type) project
Reset Ansible AWX Tower admin password
Install Ansible AWX on Microsoft Windows OS
Step by Step Install Ansible on Ubuntu OS
Install Ansible AWX Tower on Ubuntu Linux OS
Ansible AWX Tower Github inventory integration | Github inventory source

Go Back

Comment

Blog Search

Page Views

11276141

Follow me on Blogarama