Guest Customization is not applied on Windows 11 24H2 Virtual Machine.
search cancel

Guest Customization is not applied on Windows 11 24H2 Virtual Machine.

book

Article ID: 424296

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

  • Guest customization is not running automatically inside Windows 11 after using the 'Power On,Force Recustomization' button in Cloud Director.
  • DNS server IP are not applied after boot up of the operating system (OS).
  • Within the customization file C:\WINDOWS\Panther\unattend.xml the expected customization settings are visible.
  • The C:\WINDOWS\Temp\vmware-imc\guestcust.log file shows that the sysprep command had been passed to the OS by Cloud Director like this example:

    DEBUG] Executing command C:\windows\system32\sysprep\sysprep.exe /quiet /generalize /oobe /reboot /unattend:C:\WINDOWS\Panther\unattend.xml

  • Within the sysprep panther log C:\Windows\panther\setuperr.log errors like below are visible:

    Error                 SYSPRP BCD: BiUpdateEfiEntry failed c000000d
    Error                 SYSPRP BCD: BiExportBcdObjects failed c000000d
    Error                 SYSPRP BCD: BiExportStoreAlterationsToEfi failed c000000d
    Error                 SYSPRP BCD: Failed to export alterations to firmware. Status: c000000d

  • If you manually open Windows CMD prompt and execute the below command the sysprep generalize process completes after OS reboot.

    C:\windows\system32\sysprep\sysprep.exe /quiet /generalize /oobe /reboot /unattend:C:\WINDOWS\Panther\unattend.xml

Environment

VMware Cloud Director 10.6.1

Cause

This issue is caused by a Microsoft Windows issue in the sysprep process when using the /generalize option.

This results in incorrect Boot Configuration Data (BCD) settings after the generalize process completes.

The BCD errors indicate that the sysprep process is failing to properly configure the boot settings required for the guest OS.

Once this occurs it can cause any subsequent customization attempts to fail in the OS.

Resolution

  1. Prepare a new clean image using a Windows 11 installation media.

    This is preferable in order to prevent potential complications from residual Windows sysprep data that may remain in the OS from previous customization attempts.
  2. Within Windows, 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.

    Note: To learn more about this, 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

  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. Power off the VM.

  7. Ensure the Guest Customization option is enabled on the VM and desired settings applied.
  8. Save the VM as a template to a Cloud Director catalog.

  9. Deploy a new VM from the template.

  10. Power on the VM and perform guest customization using the 'Force Customization' button with the desired customization settings applied.

    Note: After the first OS boot, the OS should reboot again when sysprep is applying. After the OOBE process the script will run which and overcome the BCD errors. 

  11. Confirm that the OS customization is applied.

Additional Information

Related reading:

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

Windows 11 24H2 Guest OS Customization Fails with ShellHost.exe Error