Overview
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:

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. |
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 One drive as shown below:
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 for all users. This package will not function properly in the sysprep image.
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
Solution
Start Powershell using administrator rights and run below command to remove Onedrive. Replace the Onedrive version with what it shows in your error log file.
Remove-AppxPackage -Package Microsoft.OneDriveSync_21220.1024.5.0_neutral__8wekyb3d8bbwe
Once you run the command and restart Sysprep, it should work fine this time. Please note that the log file could show a different error than onedrive. You may need to troubleshoot accordingly. This solution is related to only onedrive package which is installed on Windows 10 and Windows 11 machines.
