When you create a windows 10 base image, you can do that with two versions of windows. The windows 10 LTSC (Long Term Servicing Channel) or with Windows 10 SAC (Semi-Annual Channel).
The windows 10 SAC is the version we are all familiar with and provides us all the new features microsoft gives use. Including all the pre-installed trash like Candy Crunch etc.
But creating a base image for windows 10 SAC can be a challenges…
I installed windows 10 (next, next, finish) and tried to create a image with this installation. But my Horizon DaaS gives me the following message:
Power off virtual machine ‘imagename’ – Timeout Error
Waited 8 minutes for virtual machine ‘imagename’ to power off.
The VMware kb tells you to extend the sysprep timeout policy, or if that not works check the sysprep log (C:\Windows\System32\Sysprep\Panther.log)
Source: https://kb.vmware.com/s/article/2126179
Off course extending the policy did not work for me….. So I needed to check the sysprep log.
When I opened the log I saw errors like:
2019-01-16 11:17:27, Error [0x0f00d8] SYSPRP WinMain:Hit failure while pre-validate sysprep generalize internal providers; hr = 0x80073cf2
2019-01-16 11:17:27, Error SYSPRP Package A278AB0D.DragonManiaLegends_4.2.1.0_x86__h6adky7gbf63m was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image.
2019-01-16 11:17:27, Error SYSPRP Failed to remove apps for the current user: 0x80073cf2.
2019-01-16 11:17:27, Error SYSPRP Exit code of RemoveAllApps thread was 0x3cf2.
2019-01-16 11:17:27, Error SYSPRP ActionPlatform::LaunchModule: Failure occurred while executing ‘SysprepGeneralizeValidate’ from C:\Windows\System32\AppxSysprep.dll; dwRet = 0x3cf2
2019-01-16 11:17:27, Error SYSPRP SysprepSession::Validate: Error in validating actions from C:\Windows\System32\Sysprep\ActionFiles\Generalize.xml; dwRet = 0x3cf2
2019-01-16 11:17:27, Error SYSPRP RunPlatformActions:Failed while validating Sysprep session actions; dwRet = 0x3cf2
2019-01-16 11:17:27, Error [0x0f0070] SYSPRP RunExternalDlls:An error occurred while running registry sysprep DLLs, halting sysprep execution. dwRet = 0x3cf2
2019-01-16 11:17:27, Error [0x0f00d8] SYSPRP WinMain:Hit failure while pre-validate sysprep generalize internal providers; hr = 0x80073cf2
According to the microsoft kb you need to do the following:
Import-Module Appx
Import-Module Dism
Get-AppxPackage -AllUser | Where PublisherId -eq 8wekyb3d8bbwe | Format-List -Property PackageFullName,PackageUserInformation
Remove-AppxPackage -Package <packagefullname>
But it is a lot of work to do it for each app, so automation is key you should think..
#delete them all.
Get-AppxPackage | ? {$_.PublisherId -eq '8wekyb3d8bbwe'} | Remove-AppxPackage
Unfortunately this did not what I expected, and had lots of errors:
Remove-AppxPackage : Deployment failed with HRESULT: 0x80073CF3, Package failed updates, dependency or conflict validation.
Windows cannot remove framework Microsoft.NET.Native.Runtime.2.2_2.2.27011.0_x86__8wekyb3d8bbwe because package(s) Microsoft.SkypeApp Microsoft.Xbox.TCUI
Microsoft.WindowsMaps currently depends on the framework. Removing all packages that depend on the framework automatically removes the framework.
NOTE: For additional information, look for [ActivityId] 0a021dff-ad7c-0001-315d-020a7cadd401 in the Event Log or use the command line Get-AppxLog -ActivityID 0a021dff-ad7c-0001-315d-020a7cadd401
It turns out that almost all apps have dependencies. In this case you need to uninstall all apps with dependecies and leave the apps without dependecies like ‘Microsoft.NET.Native.Runtime.2.2_2.2.27011.0_x86__8wekyb3d8bbwe’ alone.
The final code looks like this:
$Packages = Get-AppxPackage | ? {$_.PublisherId -eq '8wekyb3d8bbwe'}
foreach($package in $packages){if($package.Dependencies){Remove-AppxPackage -Package $package.packagefullname}}
Be aware of the fact that you need to run this code every time you reseal your sysprep image..!!
If the above code doesn’t work you can also try this one:
Import-Module Appx
Import-Module Dism
$packages = Get-AppxPackage -AllUser | Where PublisherId -eq 8wekyb3d8bbwe
foreach ($package in $packages) {Remove-AppxPackage -Package $package.packagefullname -AllUsers}
I find using the following works for me every time.
get-appxpackage -allusers | remove-appxpackage
Thanks for the help.
Second code did solve the issue. Didn’t have to import both module