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. 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
Appxpackages and to generalize the image. The provider works only if the
Appxpackage 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.
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:
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.
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:
- Delete Upgrade registry entry under
HKEY_LOCAL_MACHINE\SYSTEM\Setupregistry 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.
- 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.
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.
- Browse to HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\SoftwareProtectionPlatform and update SkipRearm DWORD reg value to 1
- Re-Install Microsoft Distributed Transaction Coordinator (MSDTC) service component of Windows using below commands
- Rename Panther folder at C:\Windows\System32\Sysprep location to Panther.old.
Sysprep.exeagain to check and confirm if its working fine now.
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.
- Windows Powershell Launching and Closing abruptly
- How to fix Microsoft store Error code 0x00000000
- How to generate SSH Key pair and connect to Ubuntu using SSH keys via Putty
- Error Code: 0xc0000001 while booting up Windows 11
- How to fix Error New-ExoPSSession: Create Powershell Session is failed using OAuth