Windows 11 installs a lot of Appx packages for every user that prevent using sysprep
.
These need to be cleared out first
Here's a script to nuke everything. Open PowerShell as Administrator and run this:
Get-AppxPackage -AllUsers | ForEach-Object { Remove-AppxPackage -Package $_.PackageFullName }
When this is done, you can run sysprep:
C:\Windows\system32\sysprep\sysprep.exe /generalize /shutdown /oobe