Sysprep was not able to validate your windows installation

Sysprep, short for System Preparation, is a Microsoft Windows tool used for preparing and customizing Windows operating system images for deployment across multiple computers. It is primarily used in enterprise and IT environments to streamline the installation and configuration of Windows on multiple computers with similar hardware.

The main idea is that Sysprep helps prepare a Windows installation for deployment on different hardware by creating a clean slate in terms of identifiers and hardware-specific configurations. This ensures that each deployed system has unique identifiers (SIDs) while allowing for the adaptation of GUIDs to the specific hardware configuration on each machine.

Recently I got an error message while performing a sysprep on a Windows 11 machine. I was preparing an Image for Azure Virtual Desktop and during Generalization of Windows 11 system, I received a pop-up error message as shown in below screenshot:

Sysprep was not able to validate your windows installation
Error Message
Sysprep was not able to validate your windows installation. Review the log file at %WINDIR%\System32\Sysprep\Panther\setupact.log for details. After resolving the issue, use Sysprep to validate your installation again.

1. SYSPRP Failed to remove apps for the current user: 0x80073cf2

Browse to the path %WINDIR%\System32\Sysprep\Panther\setupact.log and open the log file. Scroll to the end of the log file to check the error message. As per the log file the error message is related to Onedrive as shown below. You may see a different app in the error log, apply the fix accordingly.

2022-06-08 11:09:16, Info                  SYSPRP SysprepSession::CreateXPathForSelection: Sysprep mode in registry is <null>
2022-06-08 11:09:16, Info                  SYSPRP SysprepSession::CreateXPathForSelection: Processor architecture in registry is AMD64
2022-06-08 11:09:16, Info                  SYSPRP ActionPlatform::LaunchModule: Executing method 'ValidateBitLockerState' from C:\Windows\System32\BdeSysprep.dll
2022-06-08 11:09:16, Info                  SYSPRP ActionPlatform::LaunchModule: Successfully executed 'ValidateBitLockerState' from C:\Windows\System32\BdeSysprep.dll
2022-06-08 11:09:16, Info                  SYSPRP ActionPlatform::LaunchModule: Executing method 'SysprepGeneralizeValidate' from C:\Windows\System32\AppxSysprep.dll
2022-06-08 11:09:16, Info                  SYSPRP Entering SysprepGeneralizeValidate (Appx) - validating whether all apps are also provisioned.
2022-06-08 11:09:17, Error                 SYSPRP Package Microsoft.OneDriveSync_21220.1024.5.0_neutral__8wekyb3d8bbwe was installed for a user, but not provisioned cloudinfra.net. for all users. This package will not function properly in the sysprep image. cloudinfra.net.
2022-06-08 11:09:17, Error                 SYSPRP Failed to remove apps for the current user: 0x80073cf2.
2022-06-08 11:09:17, Error                 SYSPRP Exit code of RemoveAllApps thread was 0x3cf2.
2022-06-08 11:09:17, Error                 SYSPRP ActionPlatform::LaunchModule: Failure occurred while executing 'SysprepGeneralizeValidate' from C:\Windows\System32\AppxSysprep.dll; dwRet = 0x3cf2
2022-06-08 11:09:17, Error                 SYSPRP SysprepSession::Validate: Error in validating actions from C:\Windows\System32\Sysprep\ActionFiles\Generalize.xml; dwRet = 0x3cf2
2022-06-08 11:09:17, Error                 SYSPRP RunPlatformActions:Failed while validating Sysprep session actions; dwRet = 0x3cf2
2022-06-08 11:09:17, Error      [0x0f0070] SYSPRP RunDlls:An error occurred while running registry sysprep DLLs, halting sysprep execution. dwRet = 0x3cf2
2022-06-08 11:09:17, Error      [0x0f00d8] SYSPRP WinMain:Hit failure while pre-validate sysprep generalize internal providers; hr = 0x80073cf2

If you read this log file, you will find that SYSPREP Failed to remove OneDriveSync client package Microsoft.OneDriveSync_21220.1024.5.0_neutral__8wekyb3d8bbwe. In your scenario, it could be a different application(s).

SYSPRP Package Microsoft.OneDriveSync_21220.1024.5.0_neutral__8wekyb3d8bbwe was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image.

According to Microsoft, the cause of the issue is:

Sysprep has an additional provider that’s added in Windows to clean Appx packages and to generalize the image. The provider works only if the Appx package is a per-user package or an all-user provisioned package.

To Fix this issue, launch Powershell using administrator rights and run below command to remove Onedrive Appx package. Replace the Onedrive package name with what it shows in your error log file.

Remove-AppxPackage -Package <packagefullname>
Example:
Remove-AppxPackage -Package Microsoft.OneDriveSync_21220.1024.5.0_neutral__8wekyb3d8bbwe
Remove-AppxPackage -Package Microsoft.OneDriveSync_21220.1024.5.0_neutral__8wekyb3d8bbwe -AllUsers
Remove-AppxProvisionedPackage -Online -PackageName <packagefullname>
Example:
Remove-AppxProvisionedPackage -Online -PackageName Microsoft.OneDriveSync_21220.1024.5.0_neutral__8wekyb3d8bbwe

Once you run the command and restart Sysprep, it should work fine this time. For more Information about this error message, you can read about it here.

Sysprep Progress bar
Sysprep Progress bar

2. Turn BitLocker off to run Sysprep (0x80310039)

You could also find this error message in setupact.log file. This indicates that BitLocker encryption is enabled for the operating system volume, and Sysprep cannot proceed while BitLocker is active on the system. To resolve this issue, you need to temporarily disable BitLocker and then run Sysprep. Here is a snippet of error message:

Error SYSPRP BitLocker-Sysprep: BitLocker is on for the OS volume. Turn BitLocker off to run Sysprep. (0x80310039)

Error [0x0f0082] SYSPRP ActionPlatform::LaunchModule: Failure occurred while executing ‘ValidateBitLockerState’ from C:\Windows\System32\BdeSysprep.dll; dwRet = 0x80310039

This issue may occur on Windows 10/11 or previous versions due to a feature called as InstantGo, also known as InstantOn or Modern Standby (formerly Connected Standby). When you check the status of bitlocker on your device, it may show as “Encryption in progress“. To check bitlocker status, use below command:

manage-bde -status
manage-bde -status
manage-bde -status

To be able to run Sysprep.exe successfully, you will need to disable bitlocker and fully decrypt the OS drive. You can use either of the below two commands to accomplish this. When you run any of below command, it will start decrypting data on C:\ drive immediately.

manage-bde -off c:
Disable-BitLocker -MountPoint "C:"

Before you run Sysprep.exe again, Please verify once if OS volume is now fully decrypted. You can run below command to verify it. This time it should show as Fully Decrypted. You can check the Protection Status value is also showing as Protection Off.

manage-bde -status
manage-bde -status shows that Decryption of the drive is in progress
manage-bde -status shows that Decryption of the drive is in progress
manage-bde -status to check if bitlocker protection status is off and drive is Fully decrypted

You can now run Sysprep.exe again to check and confirm if the issue has been resolved.

3. Sysprep will not run on an upgraded OS

As the error message clearly states that “System will not run on an upgraded OS“. It means you may have upgraded your operating system and then trying to Sysprep it. The error message you will get is “Sysprep was not able to validate your windows installation“.

As this is a bit generic error, more information can be found in %WINDIR%\System32\Sysprep\Panther\setupact.log log file. You can open this log file and search for any errors related to Sysprep. You may find below error in the log file:

[0x0f0036] SYSPRP spopk.dll:: Sysprep will not run on an upgraded OS. You can only run Sysprep on a custom (clean) install version of Windows.

To fix this issue:

  1. Delete Upgrade registry entry under HKEY_LOCAL_MACHINE\SYSTEM\Setup registry key. This will make Windows OS believe that it’s a clean Installation not an upgrade. It is sort of a workaround to fix Sysprep Issue.
  2. Browse to HKEY_LOCAL_MACHINE\SYSTEM\Setup\Status\SysprepStatus and update GeneralizationState value to 7. You may additionally see a CleanupState DWORD registry entry with value of 2.
Delete Upgrade registry entry under HKEY_LOCAL_MACHINE\SYSTEM\Setup\Status\SysprepStatus registry key
Delete Upgrade registry entry under HKEY_LOCAL_MACHINE\SYSTEM\Setup\Status\SysprepStatus registry key

4. Sysprep a Windows device more than 3 times

By default, you cannot run Sysprep more on a Windows device more than 3 times. If you try to run Sysprep more than 3 times you may get an error message “A fatal error occurred while trying to Sysprep the machine“. To run Sysprep on a device more than 3 times, you can apply below workaround:

  • Press Windows key + R to open Run dialog box
  • Browse to HKEY_LOCAL_MACHINE\System\Setup\Status\Sysprep and make sure below CleanupState is set to 2 and GeneralizationState is set to 7.
CleanupState and GeneralizationState registry entries
CleanupState and GeneralizationState registry entries
  • Browse to HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\SoftwareProtectionPlatform and update SkipRearm DWORD reg value to 1
SkipRearm registry entry value should be set to 1
SkipRearm registry entry value should be set to 1
  • Re-Install Microsoft Distributed Transaction Coordinator (MSDTC) service component of Windows using below commands

Uninstall msdtc

msdtc -uninstall

Install msdtc

msdtc -install
  • Rename Panther folder at C:\Windows\System32\Sysprep location to Panther.old.
  • Run Sysprep.exe again to check and confirm if its working fine now.

Conclusion

In this blog post, we have seen different Sysprep Error messages and how to fix them. Hope one of the solutions listed in this post will help you running Sysprep on your device successfully. If there are still any issues with running a Sysprep and you are getting any specific error message, please let me know in the comments section.

READ NEXT