When creating reference images for Windows 10 or Windows 11, Sysprep is very likely to fail if the machine has Internet access, and have enough time to start updating it’s built-in applications, or install new ones as part of the consumer experience feature. This post is about preventing that from happening, and is a companion to my guides on building Windows 10 and Windows 11 reference images.
The issue is explained in a KB from Microsoft, but it’s workaround are not very good for automation purposes.
Sysprep fails after you remove or update Windows Store apps that include built-in Windows images
http://support.microsoft.com/en-us/kb/2769827
Note #1: This is a quite long post, and if you just want the fix, scroll to the end, to the Fixing the problem section. But if you want to pick some background info, and possibly learn something new in the process, continue as you were 🙂
Note #2: Lately I have started to simply limit Internet access to the virtual machines I’m using for reference images, especially for Windows 11 that is quite aggressive in updating for example the OneDrive application.
Symptom
If modern apps in Windows 10 are being updated during the build and capture of a reference image, Sysprep may fail because it cannot remove the update. Note that this doesn’t happen all the time, it’s a timing issue, but it sure happen often enough to be an issue.
If that happens you will get the following error in the BDD.LOG and LTISysprep.log log files:
Expected image state is IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE, actual image state is IMAGE_STATE_COMPLETE, sysprep did not succeed.
FAILURE ( 6192 ): ERROR – Sysprep did not complete successfully, check C:windowssystem32syspreppanthersetupact.log for details
Then, in the C:WindowsSystem32SysprepPanthersetuperr.log you see the following (or similar):
Error SYSPRP Package Microsoft.DesktopAppInstaller_1.0.1471.0_x64__8wekyb3d8bbwe was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image.
Error SYSPRP Failed to remove apps for the current user: 0x80073cf2.
Error SYSPRP Exit code of RemoveAllApps thread was 0x3cf2.
Error [0x0f0082] SYSPRP ActionPlatform::LaunchModule: Failure occurred while executing ‘SysprepGeneralizeValidate’ from C:WindowsSystem32AppxSysprep.dll; dwRet = 0x3cf2
Error SYSPRP SysprepSession::Validate: Error in validating actions from C:WindowsSystem32SysprepActionFilesGeneralize.xml; dwRet = 0x3cf2
Error SYSPRP RunPlatformActions:Failed while validating SysprepSession actions; dwRet = 0x3cf2
Error [0x0f0070] SYSPRP RunExternalDlls:An error occurred while running registry sysprep DLLs, halting sysprep execution. dwRet = 0x3cf2
Error [0x0f00d8] SYSPRP WinMain:Hit failure while pre-validate sysprep generalize internal providers; hr = 0x80073cf2
This is what it looks like during the MDT build and capture process.
More Details of the modern apps
Now, the above log is quite obvious, an app named Microsoft.DesktopAppInstaller_1.0.1471.0 was being installed or updated, and Sysprep could not remove it.
To see which modern applications that you have in your system, for the Administrator user account in this case. You can just run Get-AppxPackage in a PowerShell prompt, or (Get-AppxPackage).count to see the number of apps. For a Windows 10 v1607 CB machine, that did not update any built-in updates, I had 54 apps installed. Whereas as system which had been allowed to update them had 58 apps.
A Windows 10 v1607 CB machine with no updates allowed, showing 54 apps.
A Windows 10 v1607 CB machine with updates allowed, showing 58 apps.
But what about apps being actually updated? Well, you can get additional info via the Event Viewer. You go to Microsoft / Windows / AppXDeployment-Server / Microsoft-Windows-AppXDeploymentServer / Operational and filter on Event ID 478 to see successful updates.
The Event Viewer with a filter on ID 478 showing installations of modern apps.
More PowerShell
You can also view this using PowerShell, but you have to use the Get-WinEvent cmdlet, because Get-EventLog can handle only classic event logs (System/Setup/Application etc.). So here is the command to list installations/updates for Windows 10 applications.
Get-WinEvent -LogName «Microsoft-Windows-AppXDeploymentServer/Operational» | Where-Object {$_.ID -eq 478} | Select TimeCreated,Message | Format-Table -AutoSize -Wrap
Using PowerShell to list event log entries of installed/updated applications in Windows 10.
If you compare the count of apps, from the event log, from a system having the apps being updated or not (by simply putting the command in parentheses, and add a .count), you find that a system allowed to have the apps updated will have over hundred of apps, whereas as system with no Internet access, or updates being disabled will have less than hundred.
Below is the out from a system without updates to the modern apps in Window
s 10 v1607 CB, a total of 82 entries for the apps. Another machine that I deployed, and allowed it to update, it ended up with 136 entries for the apps.
A Windows 10 machine with no updates, showing 82 entries for apps in the event log.
A Windows 10 machine with updates, showing 136 entries for apps in the event log.
Fixing the problem
The obvious fix for the problem is denying the virtual machine Internet access. No Internet access means no updates breaking Sysprep 🙂
Update: Seems like setting HideShell=YES in cs.ini also prevents apps from coming down. Of course, that also stops you from doing anything interactive during the build and capture process, but hopefully you don’t need that once you nailed your task sequence. Big thanks to Roman Zuravljov for that tip.
But what if the preceding fix is not an option?
What if you need Internet access for other reasons? Well, keep on reading
Fix the Sysprep issues by adding a script to disable Store Updates as well as Consumer Experience Apps
Simply add a script that sets the needed registry values during the offline WinPE phase. So that Windows Store updates and the Consumer Experience features are disabled even before Windows 10 starts the first time. Very Shiny.
Note #1: The script has a dependency to ZTIUtility.vbs, so if put it into another folder, make sure to copy ZTIUtility.vbs with it, or update the reference in line 2 of the script.
Note #2: Disabling the Consumer Experience feature is only available for Enterprise and Education editions of Windows 10. So, if your using Windows 10 or Windows 11 Pro, you have to either disable Internet access or try the HideShell=YES settings in cs.ini.
Note #3: This script was initially developed for Windows 10 1709 and Windows 10 1809. I have not done much testing on newer versions of Windows 10, nor Windows 11. These days I typically just disable Internet access on the VM I’m building 🙂
Here is the script: http://github.com/DeploymentResearch/DRFiles/blob/master/Scripts/Config-DisableWindowsStoreUpdates.wsf
1. Copy the script to your deployment share / scripts folder, and configure your build and capture task sequence to run it in the Postinstall phase (WinPE phase).
Name: Disable Windows Store Updates
Command line: cscript.exe «%SCRIPTROOT%Config-DisableWindowsStoreUpdates.wsf»
Task Sequence configured to disable updates of Windows Store applications during the first WinPE phase.
Enabling updates once again before capture
Unless you are enabling these features via GPO during deployment, it makes sense to enable them once again just before capture. Again in the offline WinPE phase.
Note: Also this script has a dependency to ZTIUtility.vbs, so if put it into another folder, make sure to copy ZTIUtility.vbs with it, or update the reference in line 2 of the script.
Here is the script: http://github.com/DeploymentResearch/DRFiles/blob/master/Scripts/Config-EnableWindowsStoreUpdates.wsf
1. Copy the script to your deployment share / scripts folder, and configure your build and capture task sequence to run it in the end of the State Restore phase (second WinPE phase).
Name: Enable Windows Store Updates
Command line: cscript.exe «%SCRIPTROOT%Config-EnableWindowsStoreUpdates.wsf»
Task Sequence configured to enable updates of Windows Store applications just before capture.
Written by Johan Arwidmark.
The first line of that error log is the key. Microsoft has a support article describing this problem. First, you need to uninstall the Universal Windows Platform app mentioned in the error. To do that, search for it in the Start menu (it’s probably called something along the lines of «Autodesk SketchBook»), and if it’s found, right-click it and choose Uninstall. Reboot, and try to run Sysprep again.
If that doesn’t help, run this command in an elevated PowerShell prompt:
Get-AppxPackage -AllUsers | ? {$_.PackageFullName -eq '89006A2E.AutodeskSketchBook_1.5.2.0_x64__tf1gferkr813w'}
Look at the PackageUserInformation
property. If any users have the package Installed
, destroy the user account if it is not needed, otherwise log in as the user and uninstall it. If you can’t do that, use this command to remove the package for all users:
Remove-AppxPackage -Package '89006A2E.AutodeskSketchBook_1.5.2.0_x64__tf1gferkr813w' -AllUsers
Reboot and try again.
If Sysprep still refuses to continue, you need to unprovision the package (that Microsoft article says that Sysprep «will also fail if an all-user package that’s provisioned into the image was updated by one of the users on this reference computer»):
Remove-AppxProvisionedPackage -Online -PackageName '89006A2E.AutodeskSketchBook_1.5.2.0_x64__tf1gferkr813w'
You might also check the log file again if the failure remains — Sysprep might start complaining about a different package that also needs to be removed.
Almost all of the obvious bugs and errors are all related to Microsoft new environment and the APPs…
Recently, I was trying to prepare a VM Template but I was stuck at the Sysprep process with the following error.
Error SYSPRP Package Microsoft.NET.Native.Runtime.1.0_1.0.22929.0_x86__8wekyb3d8bbwe was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image. Error SYSPRP Failed to remove apps for the current user: 0x80073cf2. Error SYSPRP Exit code of RemoveAllApps thread was 0x3cf2. Error [0x0f0082] SYSPRP ActionPlatform::LaunchModule: Failure occurred while executing 'SysprepGeneralizeValidate' from C:WindowsSystem32AppxSysprep.dll; dwRet = 0x3cf2 Error SYSPRP SysprepSession::Validate: Error in validating actions from C:WindowsSystem32SysprepActionFilesGeneralize.xml; dwRet = 0x3cf2 Error SYSPRP RunPlatformActions:Failed while validating SysprepSession actions; dwRet = 0x3cf2 Error [0x0f0070] SYSPRP RunExternalDlls:An error occurred while running registry sysprep DLLs, halting sysprep execution. dwRet = 0x3cf2 Error [0x0f00d8] SYSPRP WinMain:Hit failure while pre-validate sysprep generalize internal providers; hr = 0x80073cf2 Error SYSPRP Package Microsoft.NET.Native.Runtime.1.0_1.0.22929.0_x86__8wekyb3d8bbwe was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image. Error SYSPRP Failed to remove apps for the current user: 0x80073cf2. Error SYSPRP Exit code of RemoveAllApps thread was 0x3cf2. Error [0x0f0082] SYSPRP ActionPlatform::LaunchModule: Failure occurred while executing 'SysprepGeneralizeValidate' from C:WindowsSystem32AppxSysprep.dll; dwRet = 0x3cf2 Error SYSPRP SysprepSession::Validate: Error in validating actions from C:WindowsSystem32SysprepActionFilesGeneralize.xml; dwRet = 0x3cf2 Error SYSPRP RunPlatformActions:Failed while validating SysprepSession actions; dwRet = 0x3cf2 Error [0x0f0070] SYSPRP RunExternalDlls:An error occurred while running registry sysprep DLLs, halting sysprep execution. dwRet = 0x3cf2 Error [0x0f00d8] SYSPRP WinMain:Hit failure while pre-validate sysprep generalize internal providers; hr = 0x80073cf2
After a couple of quick fix trials on my own, I couldn’t figure it out. Turns out Microsoft has a beautiful article written on the subject…
https://support.microsoft.com/en-ca/help/2769827/sysprep-fails-after-you-remove-or-update-windows-store-apps-that-inclu
Long story short, let me save you a couple of minutes of reading… This is happening because of the app packages being installed on an active user and one of the sysprep procedures is to «clean up» appx-packages, because the apps are installed or in use, this process fails… Quick fix;
Login with the initial local user account on the computer, disable all other local user accounts and make sure that you removed the user profile from Windows as well… (Open system properties, Advanced Settings, Advanced tab, click on «Settings» under «User Profiles», choose other local user accounts and remove them)
Run sysprep again!
Symptoms
Virtual machine cloning stops after copying template: sysprep fails
Log
In the copied virtual machine («C:WindowsSystem32SysprepPanthersetuperr.log»):
<Date> <Time>, Error SYSPRP Package <PackageFullName> was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image.
<Date> <Time>, Error SYSPRP Failed to remove apps for the current user: 0x80073cf2.
<Date> <Time>, Error SYSPRP Exit code of RemoveAllApps thread was 0x3cf2.
<Date> <Time>, Error [0x0f0082] SYSPRP ActionPlatform::LaunchModule: Failure occurred while executing 'SysprepGeneralize' from C:WindowsSystem32AppxSysprep.dll; dwRet = 0x3cf2
<Date> <Time>, Error SYSPRP ActionPlatform::ExecuteAction: Error in executing action; dwRet = 0x3cf2
<Date> <Time>, Error SYSPRP ActionPlatform::ExecuteActionList: Error in execute actions; dwRet = 0x3cf2
<Date> <Time>, Error SYSPRP SysprepSession::Execute: Error in executing actions from C:WindowsSystem32SysprepActionFilesGeneralize.xml; dwRet = 0x3cf2
<Date> <Time>, Error SYSPRP RunPlatformActions:Failed while executing SysprepSession actions; dwRet = 0x3cf2
<Date> <Time>, Error [0x0f0070] SYSPRP RunExternalDlls:An error occurred while running registry sysprep DLLs, halting sysprep execution. dwRet = 0x3cf2
<Date> <Time>, Error [0x0f00a8] SYSPRP WinMain:Hit failure while processing sysprep generalize internal providers; hr = 0x80073cf2
Cause
Sysprep fails after you remove or update Windows Store apps that include built-in Windows images.
Resolution
Please follow Microsoft article below to resolve the issue:
Sysprep fails after you remove or update Windows Store apps that include built-in Windows images.
Hello:
We are on Horizon 7.6, and starting to test Windows 10 1709. It appears that at the «Customization» step, the VM is just sitting at the logon screen and nothing is happening.
The sysprep log is showing:
2018-09-14 08:39:43, Error SYSPRP Failed to remove apps for the current user: 0x80073cf2.
2018-09-14 08:39:43, Error SYSPRP Exit code of RemoveAllApps thread was 0x3cf2.
2018-09-14 08:39:43, Error SYSPRP ActionPlatform::LaunchModule: Failure occurred while executing ‘SysprepGeneralizeValidate’ from C:WindowsSystem32AppxSysprep.dll; dwRet = 0x3cf2 2018-09-14 08:39:43, Error SYSPRP SysprepSession::Validate: Error in validating actions from C:WindowsSystem32SysprepActionFilesGeneralize.xml; dwRet = 0x3cf2 2018-09-14 08:39:43, Error SYSPRP RunPlatformActions:Failed while validating Sysprep session actions; dwRet = 0x3cf2 2018-09-14 08:39:43, Error [0x0f0070] SYSPRP RunExternalDlls:An error occurred while running registry sysprep DLLs, halting sysprep execution. dwRet = 0x3cf2 2018-09-14 08:39:43, Error [0x0f00d8] SYSPRP WinMain:Hit failure while pre-validate sysprep generalize internal providers; hr = 0x80073cf2
After doing some searching there are a lot of discussions on this problem with 1709 and even Msft says the fix is: «unplug the Internet connection or disable Automatic Updates in Audit mode before you create the image.». This is not an option for us. I am hoping that others have come across this and found a way to work around this problem with the VMware customization specification. I’ll follow up if we find a way around it here and post the solution.
Thanks in advance.