SOLVED: Sysprep was not able to validate your Windows installation, when run on Windows 11.

When you try and run Sysprep before imaging Windows 10 or Windows 11 you may see the error 

Sysprep was not able to validate your Windows installation.


You are told to check the log


Checking the log shows an error similar to this



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

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

SYSPRP Exit code of RemoveAllApps thread was 0x3cf2.


 While you're here -
Why not check out our Windows Server Documentation and Audit Tool?


This is because Windows store apps - more information can be found here
https://docs.microsoft.com/en-US/troubleshoot/windows-client/deployment/sysprep-fails-remove-or-update-store-apps

The code in the Microsoft article isn't very clear, instead this script should help.

You can add additional packages if SysPrep fails with another package.

Clear-Host
$packages = @('*Microsoft.BingNews*','*Microsoft.OneDriveSync*', '*Copilot*', '*Microsoft.Ink.Handwriting*')
foreach ($package in $packages)
{    
    Write-Host "Removing: $($package)";
    Get-AppxPackage -AllUsers $package | Remove-AppxPackage -AllUsers;
    Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -Like $package} | ForEach-Object { Remove-AppxProvisionedPackage -Online -PackageName $_.PackageName}
}




You may also see this issue
2025-10-09 16:19:42, Error SYSPRP ActionPlatform::LaunchModule: Failure occurred while executing 'ValidateBitLockerState' from C:\Windows\System32\BdeSysprep.dll; dwRet = 0x80310039[gle=0x00000001]

Running the following command shows that Bitlocker is enabled on the system (C:) drive and the drive is encrypted.
Get-BitLockerVolume -MountPoint "C:"

You need to decrypt the system drive before running Sysprep - this can be done with the following command.
Disable-BitLocker -MountPoint "C:"


 While you're here -
Why not check out our Windows Server Documentation and Audit Tool?

Comments

Popular posts from this blog

SOLVED: Exchange Online Management PowerShell Connect-ExchangeOnline bug "A window handle must be configured. See https://aka.ms/msal-net-wam#parent-window-handles"

Windows Server 2016, 2019, 2022, Windows 10 and Windows 11: Date and time "Some settings are managed by your organization".

get-windowsfeature : The given key was not present in the dictionary