I am making a windows 10 May 2020 image of a PC with sysprep. But it stops with an error.
To fix it I run the following PowerShell commands:
Import-Module appx
Import-Module dism
Get-AppxPackage | Remove-AppxPackage
And sysprep runs fine, finishes image:
And when starting everything works as it should, except Windows Security, which starts but does not allow access to the configuration panel, nor does it allow restarting it in "services". I cannot determine the cause of the problem, but sfc/scannow does not fix these problems.
Anyway, what I really want to know is the safest way to do this job, so it doesn't affect any essential Windows 10 apps.
PD: Here's how to exclude an app, but I don't know which packages should be excluded so it doesn't affect essential apps. Example:
Get-AppxPackage | where-object {$_.name –notlike "*store*"} | Remove-AppxPackage



