Deploying a Windows 11 24H2 VM utilizing Guest OS Customization results in the VM booting into Automatic Repair Mode
search cancel

Deploying a Windows 11 24H2 VM utilizing Guest OS Customization results in the VM booting into Automatic Repair Mode

book

Article ID: 411197

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

Booting a Windows 11 24H2 VM results in the OS entering Automatic Repair Mode.  This can happen under the following circumstances:

- Deploying the VM from a template using Guest OS Customization

- Running a Sysprep with the generalize option on a VM, and then attempting to alter the Guest OS settings such as changing the Computer Name or assigning IP addresses.

When these actions are completed, a restart of the OS will cause it to enter Automatic Repair Mode, which fails with a screen similar to the following:

Cause

This is caused by an issue with the generalize option of Sysprep, possibly also related to TPM devices.  When the generalize is run, changes to the Windows Boot Configuration Data (BCD) are made, which can cause certain changes (Computer Name, hardware additions/removals, etc.) to trigger an issue with the boot process.  This may be related to TPM/Secure Boot, but it is not known conclusively at this time.

This is a Microsoft issue, but affects VMware's Guest OS Customization as this process triggers a Sysprep generalize operation on the customized VM.

Resolution

Currently, there is no resolution.  Any resolution would have to come from Microsoft.

There is a workaround which can repair the BCD of any generalized OS before any further changes are made, which is outlined below.

To work around this issue, perform the following steps:

1.  For the VM, before you run the Sysprep generalize option or convert the VM to a template to be deployed with the Guest OS Customization feature, you need to create a post-setup script.  This script is run after the OOBE setup process, before the desktop is displayed.  To learn more about this script, you can review the Microsoft documentation here:  https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/add-a-custom-script-to-windows-setup?view=windows-11

2.  In Windows, you will need to create the following directory if it is not present:

C:\Windows\Setup\Scripts\

3.  Create a file called "SetupComplete.cmd" in the C:\Windows\Setup\Scripts\ directory.

4.  Edit the file and add the following lines:

bcdedit -set {current} osdevice partition=C:
bcdedit -set {current} device partition=C:
bcdedit -set {memdiag} device partition=\Device\HarddiskVolume1

NOTE:  The device "\Device\HarddiskVolume1" may be different on your system, but should be the location of the boot drive if you have more than one drive.  You may need to look up and identify which one would be correct for your installation.

5.  Save the file.

6.  Proceed to either run the Sysprep generalize function, or power off the VM and convert it to a template.  Once the OS is rebooted or deployed from template, after the OOBE process the script will run which will fix the issue with Automatic Repair.

Additional Information

This workaround may also resolve the problems when you encounter the following errors:

  • BiUpdateEfiEntry failed c000000d
  • BiExportBcdObjects failed c000000d
  • BiExportStoreAlterationsToEfi failed c000000d
  • Failed to export alterations to firmware. Status: c000000d