Hi Andrew Kowtalo:
Resolving Sysprep Fatal Error in Windows 11 23H2 for WDS Deployment:
The most common causes of Sysprep failures in Windows 11 involve modern apps, provisioning packages, and system state issues.
Here's a comprehensive solution:
Step 1: Mandatory AppX Package Removal
Run this PowerShell script as Administrator to remove problematic packages:
PowerShell
List of packages KNOWN to cause Sysprep failures in Win11
$problematicApps = @(
"MicrosoftTeams",
"Microsoft.549981C3F5F10", # Cortana
"Microsoft.BingWeather",
"Microsoft.Windows.Photos",
"Microsoft.GetHelp",
"Microsoft.Getstarted",
"Microsoft.MicrosoftOfficeHub",
"Microsoft.People",
"Microsoft.YourPhone",
"Microsoft.ZuneVideo",
"Microsoft.GamingApp"
)
Remove for all users
foreach ($app in $problematicApps) {
Get-AppxPackage -Name "*$app*" | Remove-AppxPackage -AllUsers -ErrorAction SilentlyContinue
}
Remove provisioned packages
foreach ($app in $problematicApps) {
Get-AppxProvisionedPackage -Online |
Where-Object DisplayName -Like "*$app*" |
Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
}
Special removal for Teams Machine-Wide Installer
Get-WmiObject -Class Win32_Product |
Where-Object Name -match "Teams Machine-Wide Installer" |
ForEach-Object { $_.Uninstall() }
Step 2: Critical Registry Fixes
Apply these registry tweaks before Sysprep:
PowerShell
reg add "HKLM\SYSTEM\CurrentControlSet\Services\CDPSvc" /v "Start" /t REG_DWORD /d 4 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Services\CDPUserSvc" /v "Start" /t REG_DWORD /d 4 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" /v "CleanupState" /t REG_DWORD /d 1 /f
Step 3: Office 365 Licensing Cleanup
Office activation state is a common blocker:
PowerShell
Reset Office licensing
Stop-Service osppsvc
Remove-Item -Path "C:\ProgramData\Microsoft\OfficeSoftwareProtectionPlatform*" -Force -Recurse
Remove-Item -Path "C:\ProgramData\Microsoft\Office\16.0\Licensing*" -Force -Recurse
Step 4: Advanced System Cleanup
- Reset scheduled tasks
Get-ScheduledTask | Where-Object { $_.State -ne "Disabled" } | Disable-ScheduledTask
- Clear event logs
wevtutil el | ForEach-Object { wevtutil cl $_ }
- Delete temporary profiles
Get-CimInstance Win32_UserProfile |
Where-Object { $_.Special -eq $false -and $_.Loaded -eq $false } |
Remove-CimInstance
Step 5: Modified Sysprep Command
Use this enhanced command sequence:
cmd
cd /d %windir%\system32\sysprep
sysprep.exe /generalize /oobe /mode:vm /shutdown /quiet
Microsoft-Supported Best Practices
- Image Maintenance Method:
- Use Windows Configuration Designer to create provisioning packages instead of modifying golden images
- Implement Windows Autopilot for zero-touch deployment
- AppX Management: PowerShell
Microsoft's recommended cleanup command
Get-AppxPackage -AllUsers |
Where-Object NonRemovable -eq $false |
Remove-AppxPackage -AllUsers
- Sysprep-Compatible Apps: | Safe to Keep | Must Remove | |--------------|-------------| | Notepad | Teams | | Calculator | Xbox | | Store* | Cortana | | Camera | Office Hub | *Store can be kept if you disable auto-updates
Log Analysis Focus Areas
Check setuperr.log
for these critical markers:
-
APPX
entries (package failures) -
CDP
(Connected Device Platform Service) -
TokenBroker
errors -
OOBE
provisioning failures -
Error 0x80073cf2
(package removal issues)
Alternative Deployment Options
If Sysprep continues to fail:
- DISM Capture (generalized image alternative): cmd dism /capture-image /imagefile:Z:\Win11Pro.wim /capturedir:C:\ /name:"Win11Pro_Deploy" /compress:max
- Enterprise Solutions:
- Microsoft Endpoint Configuration Manager
- Windows Deployment Services with custom PXE boot image
- Azure Virtual Desktop golden image approach
Final Recommendation:
For mission-critical deployments, use the Windows Assessment and Deployment Kit (ADK) for Windows 11 23H2 which includes updated Sysprep modules and compatibility fixes.
Microsoft's official stance is that heavily customized images should be replaced with provisioning packages and modern deployment methods.
Please feel free to let me know if you still have any questions.
Best regards,
BblytheX