-- MikeGore - 15 Nov 2010

SysPrep

Windows 10

  • We assume you have a fully loaded version of windows and it has been activated

Reference If you want to use MS deployment tools

Registry Fixes

    • Open regedit as Administrator (right click run as admin)
    • Delete this registry tree: HKEY_LOCAL_MACHINE\SYSTEM\Setup\Upgrade
    • Verify HKEY_LOCAL_MACHINE\SYSTEM\Setup\Status\SysprepStatus\CleanupState = 7
    • As and Admin User in CMD prompt run: slmgr /dli
      • Note: Windows should still be activated at this point if you already activated it earlier
    • Reboot!

Remove provisioned (built-in) apps in Windows 10

  • Allow Powershell to execute scripts
    • Open Command Prompt as Administrator and run:
      • powershell.exe -command set-executionpolicy unrestricted
  • Start PowerShell as Administrator
  • Download and run this powershell script: Removeapps1.ps1
  • Run this powershell command and verify the list is empty: Get-AppXProvisionedPackage -Online | Select PackageName
    • If this list is not empty seeing the section below for instructions on updating the script.
  • Restore Powershell to original execute policy
    • Open Command Prompt as Administrator and run:
      • powershell.exe -command set-executionpolicy restricted

How to update the powershell script to remove additional apps

  • To get a list of the provisioned apps
    • Get-AppXProvisionedPackage -Online | Select PackageName
      • Note: the real package name is the string prior to the first underscore '_'
      • Example Package Name: Microsoft.3DBuilder
        • So we ignore the _2015.624.2254.0_neutral_~_8wekyb3d8bbwe trailing part
    • Extract the names from the above command and add them - if required - to the following script:
      • Here is a link to the file
        • Note: it does not matter if you list a program that does not exist - it will ignore it
        • Save the script as Removeapps1.ps1

Script Removeapps1.ps1 for reference

Import-Module Appx
Import-Module Dism
   $AppsList = "Microsoft.Appconnector","Microsoft.CommsPhone","Microsoft.ConnectivityStore","Microsoft.Messaging","Microsoft.Office.OneNote","Microsoft.Office.Sway","Microsoft.WindowsAlarms","Microsoft.WindowsCalculator","Microsoft.WindowsCamera","Microsoft.WindowsPhone","Microsoft.WindowsSoundRecorder","Microsoft.WindowsStore",
    "Microsoft.BingFinance","Microsoft.BingNews","Microsoft.BingWeather","Microsoft.XboxApp","Microsoft.SkypeApp","Microsoft.MicrosoftSolitaireCollection","Microsoft.BingSports","Microsoft.ZuneMusic","Microsoft.ZuneVideo","Microsoft.Windows.Photos","Microsoft.People","Microsoft.MicrosoftOfficeHub","Microsoft.WindowsMaps","microsoft.windowscommunicationsapps","Microsoft.Getstarted","Microsoft.3DBuilder"

   ForEach ($App in $AppsList) 
   { 
      $PackageFullName = (Get-AppxPackage $App).PackageFullName
      $ProPackageFullName = (Get-AppxProvisionedPackage -online | where {$_.Displayname -eq $App}).PackageName
         write-host $PackageFullName
         Write-Host $ProPackageFullName 
      if ($PackageFullName) 
      { 
         Write-Host "Removing Package: $App"
         remove-AppxPackage -package $PackageFullName 
      } 
      else 
      { 
         Write-Host "Unable to find package: $App" 
      } 
         if ($ProPackageFullName) 
      { 
         Write-Host "Removing Provisioned Package: $ProPackageFullName"
         Remove-AppxProvisionedPackage -online -packagename $ProPackageFullName 
      } 
      else 
      { 
         Write-Host "Unable to find provisioned package: $App" 
      } 
   }

List Apps from a specific vendor

  • This may be of interest if you ever want to list packages from just one vendor
  • Example: Microsoft Packages (they have the code 8wekyb3d8bbwe )

sysprep

  • Run sysprep with Generalize and Shutdown

Windows 7

External Documents

Options

How to keep drivers when syspreping

  • Answer file updates
true

  • Another way would be to configure the registry key:
      • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\Sysprep\Settings\sppnp\PersistAllDeviceInstalls = 1

Fix Sysprep 3 times limit

    • Open administrative command prompt - we need to check the rearm counter
    • slmgr.vbs /dlv
      • If the result is zero you need to make the following registry updates - step (3)
    • Use regedit
      • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\SoftwareProtectionPlatform\SkipRearm = 1
      • Note that the image does not retain this SkipDisarm value - it gets reset after doing the sysprep
      • HKEY_LOCAL_MACHINE\SYSTEM\Setup\Status\SysprepStatus\CleanupState = 2
      • HKEY_LOCAL_MACHINE\SYSTEM\Setup\Status\SysprepStatus\GeneralizationState = 7
    • slmgr.vbs -rearm
    • msdtc -uninstall
      • wait 5 seconds
    • msdtc -install
      • wait 5 seconds
    • Restart the computer
    • When the machine is booted back up (it should still be in Sysprep audit mode)
    • Check the 3 registry keys again to confirm the values are the same. If not, change them to match the 2, 7, and 1 as detailed earlier in step 3.
    • Delete the Panther folder
    • sysprep will now works!

Moving a machine image into a Virtual Machine

Clean Up Steps

  1. Disable and Re-enable System Restore - to empty the System Volume Backups Data - this can be BIG - you do not have to reboot!
  2. Delete any archival update/patch directories in the c:\windows directory.
  3. Clear all Internet cache files, cookies, and temp. files.
  4. Delete any files in temp directories.
  5. Clear all Event Viewer logs.
  6. Empty Recycle bin.
  7. Change network settings so TCP/IP settings use DHCP not static addres

Sysprep Process

  • To sysprep use the following options /oobe /generalize /shutdown

Debugging errors

  • c:\windows\panther\unattendgc has log files if the sysprep hangs - boot the RIP image and look at the logs

Windows XP

Common Clean Up Steps

  1. Disable and renable System Restore - to empty the System Volume Backups Data - this can be BIG - you do not have to reboot!
  2. Delete any archival update/patch directories in the c:\windows directory.
  3. Clear all Internet cache files, cookies, and temp. files.
  4. Delete any files in temp directories.
  5. Clear all Event Viewer logs.
  6. Empty Recycle bin.
  7. Change network settings so TCP/IP settings use DHCP not static address.

Sysprep Process

  1. Copy CSCF sysprep to \sysprep
    • Research Sysprep: //asimov:/images/sysprep/sysprep.zip
      • unzip into the root directory
    • Core: //asimov:/coregroup1/images/sysprep/Core
      • (now look for latest sysprep directory. ie sysprep sept09/sysprep-Aug2009/sysprep - Note: NOT ZIPPED)
  2. CD \sysprep
    • Edit sysprep.inf and make any changes you need - normally only need to add an extra drivers entry)
  3. run sysprep.exe - use mini setup option and select RESEAL
  4. Restart the PC with a RIP + GHOST CD - or PXE boot on Vlan 420
    • //asimov:/images/rawiso/linux_utils/RIP/RIP11.0/RIPLinuX-11.0.iso
      • Note: RIP has been modified by the CSCF Research Group
  5. Read over ImageDeploymentGhost
Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatps1 Removeapps1.ps1 r2 r1 manage 1.6 K 2016-07-24 - 21:58 MikeGore Remove Provisioned Apps
Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r11 - 2016-07-24 - MikeGore
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback