Windows 11 Golden Image Preparation for OCI | Sysprep Guide

Golden Image Preparation: Windows 11 Sysprep Automation for OCI

Overview

This article walks you through preparing a Windows 11 virtual machine as a golden image for deployment on Oracle Cloud Infrastructure (OCI). The process is automated by three PowerShell scripts that run on a build VM: one shared configuration file and two step scripts that execute before and after a reboot. When the scripts finish, the VM is generalized with Sysprep and ready to be captured as a custom OCI image.

Prerequisites

  • A Windows 11 build VM where you will run the scripts.
  • Administrator privileges on the build VM.
  • At least 2 GB of free disk space.
  • Internet connectivity to download the required software.
  • The three script files: _Config.ps1, Step1_PreReboot.ps1, and Step2_PostReboot.ps1
  • The Thinfinity Workspace Agent Network ID and Gateway URLs for your deployment.

Download Files

What each step does

Step 1: Pre-reboot validations and cleanup

Step 1 validates the environment, applies the required fixes, and reboots the VM. The table below summarizes every check and the action taken.

CheckAction
Administrator privilegesRequired to run the script.
Windows 11Verifies the OS version.
Disk spaceConfirms at least 2 GB free.
Internet connectivityRequired for software downloads.
SysprepVerifies the executable is available.
BitLockerDisables encryption and waits for full decryption.
Network (IP/DNS)Switches static configuration to DHCP if needed.
Remote DesktopEnables RDP and the firewall rule if disabled.
Remote Desktop UsersDisplays the group members for review.
Time ZonePrompts for the time zone.
Language PackPrompts for the locale and installs the language pack.
Pre-existing softwareRemoves Cloudbase-Init and VirtualBox Guest Additions if present.

The VM reboots at the end of Step 1.

Step 2: Post-reboot installation and Sysprep

Step 2 installs the software required by OCI and Thinfinity, cleans up the image, and runs Sysprep.

PhaseAction
Download softwareDownloads the Thinfinity Workspace Agent and Cloudbase-Init installers.
Generate unattend.xmlConfigures OOBE skip, Administrator password, and RDP.
Kill processesTerminates and disables non-essential services, scheduled tasks, and startup entries.
Thinfinity AgentPerforms a silent install and configures the Network ID and Gateway URLs. Pauses for manual log verification.
Cloudbase-InitSilent install with service user cb and metadata password disabled.
AppX cleanupRemoves conflicting AppX packages that block Sysprep.
Remove TeamsRemoves Microsoft Teams.
SysprepRuns sysprep /generalize /oobe /shutdown.

The VM shuts down automatically after Sysprep completes.

How to run the scripts

Copy _Config.ps1, Step1_PreReboot.ps1, and Step2_PostReboot.ps1 into the Downloads folder of the logged-in user on the target VM, then follow the steps below.

Allow script execution

Open PowerShell as Administrator. If script execution is restricted on the VM, run the following command to allow scripts for the current session only:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

This change does not modify the system-wide policy.

Run Step 1

  1. Navigate to the Downloads folder:
    cd ~\Downloads
  2. Run the pre-reboot script (no parameters required):
    .\Step1_PreReboot.ps1
  3. Respond to the time zone and language prompts when requested.
  4. Confirm the reboot when the script prompts you.

Run Step 2

  1. After the VM reboots, open PowerShell as Administrator again and return to the Downloads folder:
    cd ~\Downloads
  2. Run the post-reboot script:
    .\Step2_PostReboot.ps1
  3. Provide the Network ID and Gateway URLs when the script prompts for them.
  4. When the script pauses after configuring the Thinfinity Workspace Agent, open the agent logs and confirm that the agent has connected to the gateway. Press ENTER only after connectivity is verified.
  5. Let the script finish. It will run Sysprep and the VM will shut down automatically.

Create the custom image

Important: After the VM shuts down, wait 30 minutes before creating the image. Do not start the VM or modify its state during this window — doing so will invalidate the generalized state and you will have to repeat the preparation.

  1. Wait 30 minutes after the Sysprep shutdown completes.
  2. In the OCI Console, open the build VM's instance page.
  3. Create a custom image from the stopped instance.

Troubleshooting

The script cannot be executed

If PowerShell refuses to run the script, make sure you launched the session as Administrator and that you ran the Set-ExecutionPolicy command in the same session.

Sysprep fails

Sysprep typically fails because of AppX packages installed per user or leftover Cloudbase-Init or VirtualBox Guest Additions components. Re-run Step 1 to confirm the cleanup checks pass, then re-run Step 2. Review C:\Windows\System32\Sysprep\Panther\setupact.log and setuperr.log to identify the specific blocking package.

The Thinfinity Agent does not connect

If the agent log does not show a successful connection during the Step 2 pause, verify the Network ID and Gateway URLs you provided, confirm outbound connectivity from the VM to the gateway, and re-run the agent configuration before pressing ENTER to continue.


    • Related Articles

    • VergeIO in Thinfinity Cloud Manager: Support Guide

      Overview Thinfinity Cloud Manager integrates with VergeIO (VergeOS) to deliver full VDI and DaaS lifecycle automation on top of the VergeIO hypervisor. The integration covers golden-image–based provisioning, both domain-joined and workgroup ...
    • Thinfinity VDI Performance Troubleshooting Guide

      Overview When a user reports that their Thinfinity Workspace VDI session feels slow, the root cause can sit in many layers: the user's local device, their network, the VDI host, or the Thinfinity platform itself. This guide gives you a structured, ...
    • How to Enable VDI Manager

      Introduction to VDI Manager in Thinfinity Workspace The Virtual Desktop Infrastructure (VDI) Manager is an integral component of the Thinfinity Workspace, designed to streamline and simplify the management of cloud-based virtual resources. This ...
    • Troubleshooting Keyboard Layout Issues in Thinfinity Workspace

      Overview Keyboard layout problems in Thinfinity Workspace sessions usually trace back to a mismatch between the client device, the Windows lock/logon screen, the user's profile, or the Thinfinity Access Profile. The wrong character appearing when you ...
    • What's New on Thinfinity Remote Workspace 8

      Introduction Welcome to our comprehensive guide to the Thinfinity® Workspace 8. This article will introduce you to the product's groundbreaking features, new connection protocols, and enhanced user experience. Thinfinity Workspace 8 is the epitome of ...