SOP Creating a Sealed Image of Windows Server with Microsoft SQL Server 2022


Summary

This article provides information about preparation of sealed images for Windows Virtual Machines with MS SQL Server 2022.

Applies To

Applies to MachPanel v8 and onward.

Procedure for creating Windows VM Sealed Images with MS SQL Server 2022
STEP-1: CREATE VM

Minimum Disk Space 10-12 GB: Create a VM to host the operating system of your choice with minimal disk space i.e. from 10 to 12 GB, as the purchased storage will then be added to respective VM later based on Service Plans.

Required Partition Settings:

Proper disk partitioning is critical for successful deployment. The recommended partition order is:

  1. EFI System Partition (ESP) - SYSTEM
  2. Recovery Partition (WinRE) - MSR (Reserved)
  3. Windows (C:) - Primary

Hint : Create the Windows (C:) partition first (by selecting "New" in the Windows Setup dialog), Windows Setup automatically creates the required UEFI/GPT partitions in the correct order behind the scenes.

STEP-2 SCHEDULED TASK

In order to set Machine Name, Password and IP Address of VM, a "Scheduled Task" in sealed image must be created. Please review details below to create a scheduled task to allow MachPanel to "Set Password" and process other OS initialization steps in Gen1 & Gen2 VM: Creating Scheduled Task

Note: There is a difference between creation of scheduled task for Gen1 and Gen2 type virtual Machines. Please check details in above KB and create task accordingly.

STEP-3 Installing Microsoft SQL Server 2022 as Built-in part of Windows Sealed Image

Perform these steps on your reference Windows Server 2022 machine before running Windows SysPrep

  • Mount or attach the SQL Server 2022 Standard installation media to VM.
  • Launch setup.exe to open the SQL Server Installation Center
  • In the left navigation menu, click Advanced
  • Select Image preparation of a standalone instance of SQL Server 

​​

  • Accept License terms
  • Select the desired Features
  • Give Instance ID , (e.g. MSSQLSERVER, SQL2022STD)

​​

  • Complete rest of steps, click prepare

STEP-4: SEAL THE IMAGES / PREPARE WINDOWS VM SEALED IMAGES
  1. Download the sample / generic sysprep.xml file provided in download section in this article (adjust it if required per your requirements).
  2. Copy sysprep.xml to C:\Windows\System32\sysprep inside the VM that needs to become your sealed image / OS template.
  3. Open Command Prompt as Administrator
  4. Navigate to SysPrep Directory: CD C:\Windows\System32\sysprep>
  5. Run command:  sysprep.exe /generalize /oobe /shutdown /unattend:sysprep.xml
  6. On completion, you will find the VM in shutdown state.
  7. ​Your sealed image is ready. You can copy this <name>.VHD / <name>.VHDX file to MachPanel's Sealed Image repository directory and specify the path to the prepared file in MachPanel configuration.
STEP-5: After VM Provisioned

On Each VM deployment

  • Use the “Image completion of a prepared stand-alone instance” from start menu

  • During SQL Complete Image, provide:
    • Product key (for Standard edition)
    • Instance name (can differ from Instance ID)
    • Service accounts (e.g., NT Service\MSSQLSERVER or domain accounts)
    • SQL Server administrators (Add current user)