Preparing Windows 10 to run a 'Prepare for Image Capture' (sysprep) task using Deployment Solution 7.x/8.x

book

Article ID: 161011

calendar_today

Updated On:

Products

Deployment Solution

Issue/Introduction

Prepare for image capture fails when you try to prepare to capture an image. 

Sysprep changes are not implemented after imaging. Post-imaging issues including duplicate GUIDs, other tasks fails, imaging fails, etc.

Environment

Deployment Solution 7.x / 8.x.

Resolution

OVERVIEW:

This method will remove Windows Store Apps that are provisioned as '-allusers' from the operating system.  An application such as 'Microsoft Edge' and possibly 'Microsoft.ECAapp' may remain but Sysprep will not fail on these applications. Once the apps are removed the 'prepare for image capture' task can be scheduled against the system and the system will be in 'fresh' state.


Note: Instructions are for Windows 10 build 1607 and later.  ITMS 8.0 Post HF6 and later contain changes to the 'prepare for image capture' task that allows the task to continue if the upgrade key in the registry is set (Windows 10 sysprep no longer stops if the upgrade key is set).


I. Perform a clean installation of Windows 10

  1. Use physical media (CD/DVD) or extract ISO content to a USB drive to install Windows 10
  2. After installation create a new local Administrator account and join it to the Administrators Group
  3. Log in to the system as the recently created local Administrator account

II. Perform 'Prepare for image capture' prerequisite tasks

  1. Disable Automatic update of Windows Store apps (Because the design of the Windows Store changes with each Windows 10 build release, the steps below will vary)
    1. Open 'Windows Store'
    2. Click 'Windows Start Button > Store'
    3. At the top right of the 'Store' click on '…'
    4. Click on 'Settings'
    5. Move the slider on setting 'Update apps automatically' from 'on' to 'off'
  2. Use 'Windows update' to install the latest patches to the system
    1. Delay Feature Updates (Build 1703/1709 steps.  Steps are slightly different in build 1803)
      1. Click 'Windows Start Button > Settings > Update and security > Windows Update'
      2. On the right side click 'Advanced Options'
      3. Click on the drop-down box under 'A feature update includes new capabilities and improvements.  It can be deferred for this many days:
        1. Select '8'
    2. Install Updates
      1. Click 'Windows Start Button > Settings > Update and security > Windows Update'
      2. Click 'Check for updates'
    3. Make sure that all reboots are completed after patches are applied
      1. Login back into the system as the recently created local Administrator Account
      2. Verify system has not been upgraded to a new version of the OS
  3. Install Symantec Management Agent and subagents
    1. Deployment Solution Plug-in
      1. Allows 'Prepare for image capture' task to run
  4. Disable User Access Control (UAC) NOTE:  This is NOT necessary on systems that have >= '8.1 RU5' or '8.0 Post_HF6v5' installed
    1. Open Regedit.exe
    2. Check for the following key:
      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System.  
    3. Set EnableLUA to '0'
    4. Reboot the computer    
    5. Log in as the local Administrator created during installation
  5. Remove Windows Store Apps (Also known as 'modern' or 'UWP' apps)
    1. NOTE: These apps will automatically be reinstalled by Microsoft mini-setup after the source system is rebooted to production.
    2. Log into the system with local administrator account created during install.  
    3. Click on the 'Cortana' icon (circle next to start) in the taskbar and search for 'Powershell'. Wait for the Windows PowerShell application to appear at the top.
    4. Right Click 'Windows Powershell' at the top of the list and choose 'Run as Administrator'.
    5. In the Powershell window, type:
      1. Get-AppxPackage -AllUser | Where PublisherId -eq 8wekyb3d8bbwe | Format-List -Property PackageFullName,PackageUserInformation
        1. This command lists the Windows 10 'Modern/Windows Store' packages/apps that are 'Installed' for the user(s)
      2. Get-AppxPackage -AllUsers | Remove-AppxPackage
        1. Errors will be displayed but this is okay. This command removes the Windows store apps for the currently logged in user.  It DOES NOT remove the apps from other users on the system.  It is removing every app that is provisioned as 'AllUsers'
      3. Get-AppxPackage -AllUser | Where PublisherId -eq 8wekyb3d8bbwe | Format-List -Property PackageFullName,PackageUserInformation
        1. This command shows if the apps have been returned to a 'staged' state.  
          1. If applications besides Microsoft Edge and possibly Microsoft.ECAapp continue to show as 'Installed' for the user, Sysprep will fail.
          2. THIS STEP WILL NOT BE NEEDED IF THE STEPS IN THIS KB HAVE BEEN FOLLOWED: Should the packages show that another user is still installed after running this PowerShell script, repeat steps under section 'II > 5 > 2'above substituting the appropriate user(s) for the 'local administrator account created during install'
          3. Once all applications - except Microsoft.ECAapp and possibly other Edge packages- are in a 'staged' state, continue to step '3' below

III. Run the Prepare for Image Capture against the system

  1. Make sure 'Run Sysprep with Admin Credentials' is selected.
    1. The username that is supplied below the checkbox needs to be the same account that is currently logged into the client system.   
      1. Though the UI specifies 'domain\user name' put in the local computer name and user. E.g   'win10pro-0\' or '.\'
        1. Capture the image, then reboot back to production.

Troubleshooting:

Note: Before calling support for assistance, gather the 'dstasks.log' file (\program files\altiris\altiris agent\deployment\logs), along with 'setupact.log' and 'setuperr.log' from ':\Windows\System32\Sysprep\Panther' from the system.

  • If Sysprep runs forever with 0% CPU one of the following may be occurring:
    1. There are Windows Store apps that are in the installed state.  
    2. Verify that the following PowerShell command shows that all apps are cleared:
      Get-AppxPackage -AllUser | Where PublisherId -eq 8wekyb3d8bbwe | Format-List -Property PackageFullName,PackageUserInformation
    3. Run PowerShell command again: 
      Get-AppxPackage -AllUsers | Remove-AppxPackage
  • Sysprep logs show: 'System Preparation Tool 3.14 A fatal error occurred while trying to sysprep the machine'
    1. The Windows Store apps have updated and are provisioned for 'one user' instead of 'all users'.  
      1. Read Microsoft KB https://support.microsoft.com/en-us/kb/2769827
        1. The solution in this KB does not always work
  • The computer\username supplied to the 'prepare for image capture' task doesn't have sufficient rights
    • Ensure that the user is an administrator to the system.
  • The system may have been logged into with more than one user
    1. Log in to the system for each user that has previously logged in
    2. Follow Remove Windows Store Apps (Also known as 'modern' or 'UWP' apps) steps above

Additional information from third party sources regarding issues can be found here:

  • http://support.microsoft.com/kb/2769827
  • https://kb.vmware.com/s/article/2079196
  • https://virtuallyinclined.com/2017/01/08/windows-10-appx-packages-can-break-sysprep/
  • http://www.thewindowsclub.com/disable-automatic-updates-for-windows-store-apps-in-windows-10
  • https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/sysprep--generalize--a-windows-installation