OEM Deployment of Windows 11 desktop editions

Getting ready to build and test Windows PCs? This lab shows you the steps to make and deploy Windows images. We'll show you how to use the tools and commands to setup an end-to-end deployment. The commands can be scripted, helping you quickly customize new images for specific markets to meet your customers' needs.

We'll walk you through the process of building a customized Windows deployment. Here's what we'll cover:

Image showing the flow of a Windows deployment. The first step in the flow is to prepare by gathering collateral, installing the ADK, and Create a WinPE drive. Then you create images by adding language packs, features on demand, apps, driver packages, updates, configuring unattend and start layouts, configuring hardware settings, and setting the edition. Finally you can apply your image as an ffu or WIM.

We'll start by preparing your environment, then we'll cover the steps for:

  • Preparing and mounting a WinPE image
  • Adding packages
  • Adding driver packages
  • Creating WinPE media

Next we'll move onto customizing your Windows image. We'll start with offline customizations to a mounted Windows image, where we'll cover:

  • Adding Driver Packages
  • Adding Languages
  • Adding Updates
  • Reinstalling inbox apps
  • Preinstalling Microsoft Office
  • Customizing the Start Layout
  • Customizing the Taskbar
  • Setup OOBE to display a custom EULA
  • Configuring and using answer files to customize Windows Setup

We'll finish customizing the Windows image by deploying your image to a PC and then booting into Audit mode and finish making changes, including:

  • Making changes in Audit mode
  • Preparing Push Button Reset

Finally, we'll Finalize and Capture your image, verify everything works, and prepare your image for deployment.

  • Finalizing the image

Let's get started!

Prepare your lab environment

Note

If you haven't gathered the files you need to go through this lab, see Get the tools you need for OEM deployment of Windows desktop editions.

At this point, you should have your tools ready to go. At this point, you should have:

  • A USB drive, formatted with two partitions:

  • A technician PC that has:

    • A folder called C:\temp\lab with the following media downloaded:
      • Windows installation media
      • The most recent version of the Microsoft Office OPK
      • Language and Optional Features ISO
      • OPK App Update or Inbox Apps ISO
      • Windows ADK installer
      • WinPE ADK Add-on
      • Driver packages for your image (if needed)
      • Deployment scripts

Let's setup your lab.

Install the Windows ADK

The Windows ADK is a collection of tools that enables you to manage and deploy custom Windows installations to new computers.

On your technician PC:

  1. If you have a previous version of the Windows Assessment and Deployment Kit (ADK), uninstall it.

  2. Download the latest version of the Windows ADK that matches the version of Windows that you're installing.

  3. Run the ADK installer to install the ADK with the following options:

    • Deployment Tools
    • User State Migration Tool (USMT)
    • Windows Preinstallation Environment (Windows PE)
  4. Install the WinPE Add-ons for the ADK.

Create a bootable Windows PE (WinPE) partition

WinPE is a small, command-line based operating system that you can use to capture, update, and optimize Windows images. In this section, we'll show you how to prepare a basic WinPE image on a bootable USB flash drive and try it out.

Prepare WinPE files

  1. On your technician PC, start the Deployment and Imaging Tools Environment as an administrator:

    • Click Start, type Deployment and Imaging Tools Environment. Right-click Deployment and Imaging Tools Environment and select Run as administrator.
  2. Use copype to create a working directory that has the base WinPE files:

    copype amd64 C:\winpe_amd64
    

    Tip

    If this doesn't work, make sure you're in the Deployment and Imaging Tools Environment, and not the standard command prompt.

Customize WinPE

You can customize a WinPE image (boot.wim) in several ways by adding files and components to a mounted WinPE image.

Here are some examples of how you can modify your WinPE image:

  • Add an optional component. WinPE Optional components ship in the ADK. These are packages that you can add to your WinPE image to add functionality to WinPE.

  • Add a graphics or network driver package. WinPE includes generic video, but in most cases, additional driver packages are needed to show the screen or connect to the network. To learn more, see WinPE: Add drivers.

  • Set the power scheme to high-performance. Speeds deployment. Note, our sample deployment scripts already set this scheme automatically. See WinPE: Mount and Customize: High Performance.

  • Optimize WinPE: Recommended for devices with limited RAM and storage (for example, 1GB RAM/16GB storage). After you add driver packages or other customizations to Windows PE, see WinPE: Optimize and shrink the image to help reduce the boot time.

When you add packages to WinPE, performance will be reduced and boot time will increase. Only add packages that you need to complete a successful deployment.

Mount your WinPE image

To customize a Windows image, you have to mount it before you can work with it. This is true for WinPE images as well. Mounting an image extracts the contents of an image file to a location where it can be viewed and modified. Throughout this lab we'll use DISM to mount and modify images. DISM comes with Windows, but we'll be using the version that is installed by the ADK, which we'll access through the Deployment and imaging tools environment.

Boot.wim is the WinPE image file. You can find it in the files that you copies with copype.cmd.

Mount the image:

  • From the Deployment and imaging tools environment, mount the image:

    Dism /mount-image /imagefile:c:\WinPE_amd64\media\sources\boot.wim /index:1 /mountdir:c:\winpe_amd64\mount
    

Add packages, optional components, dependencies, and language packs to WinPE (optional)

Use Dism /Add-Package to add packages to your mounted WinPE image. The ADK has WinPE Optional Components you can add for additional WinPE functionality. Some packages have dependencies and require other packages to be installed. For these packages, you'll have to install the dependencies before you add the a package. For example, if you want to use Powershell in WinPE, you have to install the NetFx as well as the language-specific OCs. You can find OC CABs in C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\<arch>\WinPE_OCs\. Here's how to add Powershell support for en-us:

Dism /Add-Package /Image:"C:\WinPE_amd64\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-WMI.cab"  /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-WMI_en-us.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-NetFX.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-NetFX_en-us.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-Scripting.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-Scripting_en-us.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-PowerShell.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-PowerShell_en-us.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-StorageWMI.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-StorageWMI_en-us.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-DismCmdlets.cab" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-DismCmdlets_en-us.cab"

Note

Only add additional packages when necessary. The more packages you add, the greater the impact to boot time and performance.

Add driver packages to WinPE (If needed)

If you need to add driver packages to WinPE, you'll use Dism /Add-Driver. You'll only need to do this if WinPE doesn't already include the driver packages for your hardware.

Here's how to add driver packages to WinPE:

dism /image:C:\winpe_amd64\mount /Add-Driver /driver:"C:\Out-of-Box Drivers\mydriver.inf"

Where C:\Out-of-Box Drivers\mydriver.inf is the path of the driver package you're adding.

To install all of the driver packages in a folder and all its subfolders use the /recurse option. For example:

Dism /Image:C:\Winpe_amd64\mount /Add-Driver /Driver:c:\drivers /recurse

Where C:\drivers is the driver packages folder that you're adding.

Set the power scheme to high-performance

Setting WinPE to use high-performance mode will speed deployment. The sample scripts set WinPE to high-performance mode when they run, but if you want to make sure that WinPE always runs in high-performance mode, you can modify startnet.cmd in the WinPE image.

  1. Use notepad to open C:\Winpe_amd64\mount\windows\system32\startnet.cmd

    notepad C:\Winpe_amd64\mount\windows\system32\startnet.cmd
    
  2. Add the following line to startnet.cmd:

    powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
    
  3. Save the file and close Notepad.

Cleanup your WinPE image

Run dism /cleanup-image to reduce the disk and memory footprint of WinPE and increase compatibility with a wide range of devices:

DISM /image:c:\winpe_amd64\mount /Cleanup-image /StartComponentCleanup

See WinPE: Optimize and shrink the image for more details.

Commit your changes and unmount your image

If you've added extra files in your WinPE image, you can delete them to reduce your image size and improve performance. When you're done working with your image, you can commit your changes and unmount your image. Then export your customized WinPE image into your WinPE folder:

dism /unmount-image /mountdir:c:\winpe_amd64\mount /commit
dism /export-image /sourceimagefile:c:\winpe_amd64\media\sources\boot.wim /sourceindex:1 /DestinationImageFile:c:\winpe_amd64\mount\boot2.wim
Del c:\winpe_amd64\media\sources\boot.wim
Copy c:\winpe_amd64\mount\boot2.wim c:\winpe_amd64\media\sources\boot.wim

Create a bootable WinPE drive

Now that you've updated your WinPE image to include everything it needs, you can make a bootable WinPE drive. From the Deployment and Imaging Tools Environment:

  1. Connect your USB key to your technician PC.

  2. Copy WinPE to the WinPE partition:

    MakeWinPEMedia /UFD C:\winpe_amd64 P:
    

    Where P: is the letter of the WinPE drive.

    When prompted, press Y to format the drive and install WinPE.

Boot your reference PC to WinPE

  1. Connect the USB drive to your reference device.

  2. Turn off the reference device, and then boot to the USB drive. You usually do this by powering on the device and quickly pressing a key (for example, the Esc key or the Volume up key).

    Note

    On some devices, you might need to go into the boot menus to choose the USB drive. If you're given a choice between booting in UEFI mode or BIOS mode, choose UEFI mode. To learn more, see Boot to UEFI Mode or Legacy BIOS mode. If the device does not boot from the USB drive, see the troubleshooting tips in WinPE: Create USB Bootable drive.

    WinPE starts at a command line, and runs wpeinit to set up the system. This can take a few minutes.

Leave this PC booted to Windows PE for now. You can remove the bootable USB drive.

Customize your Windows image

Now that you have your WinPE image customized for your deployment, we'll get into how to get your Windows image ready for deployment. The process is similar to how we changed our WinPE image, but Windows has many additional customization options.

You can make either offline or online customizations to a Windows image. Offline customizations are done to the windows image (install.wim) from either the Technician PC or from the destination PC while booted into WinPE. In most scenarios, offline customizations are customizations you perform from the Technician PC. Online customizations are done on the Reference PC after it's been booted into audit mode.

The table below shows which customizations can be made online and offline. In a manufacturing environment, it's recommended to do as many customizations as possible offline.

Scenario Offline Online
Adding device drivers X X
Adding Microsoft Store apps X X
Adding Desktop (win32) apps - X
Adding language packs X X
Remove default language pack X -
Adding features-on-demand X X
Adding the latest cumulative update X X
Image optimization X X
Microsoft Store apps duplicate files cleanup X -
Microsoft Office X X

Prepare and mount a Windows image

mount and customize process that shows that you mount an image into a folder, modify the mounted image by adding drivers, languages, packages, etc. Then you use DISM to save your changes to the image and unmount it.

In this section we'll cover how to mount Windows images on your technician PC. Mounting a Windows image is the same process that we used to mount the WinPE image earlier. When we mount our Windows image (install.wim), we'll be able to access a second image, WinRe.wim, which is the image that supports recovery scenarios. Updating install.wim and WinRE.wim at the same time helps you keep the two images in sync, which ensures that recovery goes as expected.

Before we continue, make sure that you've created your C:\Temp\Lab folder on your technician PC. We showed you how to set it up in the Get the tools you need section.

Backup your Windows image file

Before working on your Windows image, you want to make sure you have a backup copy in case something goes wrong. Make a copy of the original image:

First copy the install.wim from your Windows installation media to C:\temp\lab\images. Install.wim includes both Home and Professional images. We'll export the Home image from install.wim, and then work with that image during this lab.

  1. Mount the Windows installation media.

  2. From the mounted installation media, copy D:\sources\install.wim to C:\temp\lab\images. (Where D: is the drive letter of the mounted installation media.)

  3. From the Start menu, open Windows Kits, open the Deployment and Imaging Tools Environment as administrator.

  4. Make a copy of your image in case something goes wrong.

    copy "C:\temp\lab\Images\install.wim" C:\temp\lab\Images\install-backup.wim
    
  5. Export the Home edition (index 2) from install.wim as basicimage.wim and delete the original C:\temp\lab\images\install.wim:

    Dism /export-image /sourceimagefile:C:\temp\lab\images\install.wim /sourceindex:2 /destinationimagefile:C:\temp\lab\images\basicimage.wim
    Del C:\temp\lab\images\install.wim
    

    Now that you have your image exported, you can mount it.

Mount your Windows image

Create a mount directory and mount basicimage.wim:

Md C:\mount\windows
Dism /Mount-Wim /WimFile:C:\temp\lab\images\basicimage.wim /index:1 /MountDir:C:\mount\windows

Mount your WinRE image

If a system can't successfully boot into Windows, it will fail over to the Windows Recovery Environment (WinRE). WinRE can repair common causes of unbootable operating systems. WinRE is based on WinPE, and to make it work for your customers, you can add driver packages, languages, Windows PE Optional Components, and other troubleshooting and diagnostic tools.

The WinRE image is included inside the Windows image, and is eventually copied to the Windows RE tools partition on the destination PC or device. To modify the WinRE image, you'll mount the Windows image, then mount the WinRE image inside it. Make your changes, unmount the WinRE image, then unmount the Windows image.

Image showing that you can mount and windows image, and then mount an image from the mounted image's mount folder so you can configure two nested images.

If you're adding any of the following to your image, you should also update your recovery image with the same changes:

  • Add boot-critical driver packages, such as the graphics and storage driver packages.
  • Add major updates to Windows, like LCUs.
  • Add new languages, though this isn't always possible, as not all languages have Windows RE equivalents.

Note

This lab assumes you'd rather keep winre.wim inside of install.wim to keep your languages and driver packages in sync. If you'd like to save a bit of time on the factory floor, and if you're okay managing these images separately, you may prefer to remove winre.wim from the image and apply it separately.

  • Mount the Windows RE Image file from your mounted image.

    Md c:\mount\winre
    Dism /Mount-Wim /WimFile:C:\mount\windows\Windows\System32\Recovery\winre.wim /index:1 /MountDir:C:\mount\winre
    

    Tip

    If winre.wim cannot be seen under the specified directory, use the following command to set the file visible:

    attrib -h -a -s C:\mount\windows\Windows\System32\Recovery\winre.wim
    

    Troubleshoot: If the mounting operation fails, make sure you're using DISM from the Deployment and Imaging Tools Environment. Do not mount images to protected folders, such as the User\Documents folder. If DISM processes are interrupted, consider temporarily disconnecting from the network and disabling virus protection.

Offline customizations

With your images mounted, you can start customizing. We'll show you how to make offline customizations to your Windows image. Offline customizations are changes that you can make to a mounted image without having to boot into the Windows installation. First, we'll walk through adding (and removing) languages from your Windows image.

Languages

In this section, we'll show you how to add languages to a Windows installation. If you want to add a language, you'll need a language pack from the Languaged and Optionsl Features ISO, as well as an internet connection or access to the Feature on Demand ISO.

Note

  • Add languages before adding a cumulative update (LCU). If you add a language after a cumulative update, you'll need to reinstall the update.
  • Add apps after languages and Features on Demand. Universal Windows apps and desktop applications need to be reinstalled if you add a language after installing an app.
  • Add your languages to your recovery image, too: Many common languages can be added to your recovery image.

Always use language packs and Features-On-Demand (FOD) packages that match the language and platform of the Windows image.

Features on demand (FODs) are Windows feature packages that can be added at any time. When a user needs a new feature, they can request the feature package from Windows Update. OEMs can preinstall these features to enable them on their devices out of the box.

Common features include language resources like handwriting recognition. Some of these features are required to enable full Cortana functionality.

The following table shows the types of available language components:

Component Sample file name Dependencies Description
Language pack Microsoft-Windows-Client-Language-Pack_x64_de-de.cab None UI text, including basic Cortana capabilities.
Basic Microsoft-Windows-LanguageFeatures-Basic-de-de-Package None Spell checking, text prediction, word breaking, and hyphenation if available for the language. You must add this component before adding any of the following components.
Fonts Microsoft-Windows-LanguageFeatures-Fonts-Thai-Package None Fonts required for some regions. Example, th-TH requires the Thai font pack.
Optical character recognition Microsoft-Windows-LanguageFeatures-OCR-de-de-Package Basic Recognizes and outputs text in an image.
Handwriting recognition Microsoft-Windows-LanguageFeatures-Handwriting-de-de-Package Basic Enables handwriting recognition for devices with pen input.
Text-to-speech Microsoft-Windows-LanguageFeatures-TextToSpeech-de-de-Package Basic Enables text to speech, used by Cortana and Narrator.
Speech recognition Microsoft-Windows-LanguageFeatures-Speech-de-de-Package Basic, Text-To-Speech recognition Recognizes voice input, used by Cortana and Windows Speech
Retail Demo experience Microsoft-Windows-RetailDemo-OfflineContent-Content-de-de-Package Basic, plus the language-neutral Retail Demo package: Microsoft-Windows-RetailDemo-OfflineContent-Content-Package Retail Demo experience.

Add or change languages

In this section, we'll add languages and Features On Demand to your Windows image. We'll add the German (de-de) language pack, then we'll add the Japanese (ja-jp) language. Japanese is an example of a language that requires additional font support.

Important

If you install an update that contains language-dependent resources prior to installing a language pack, the language-specific changes in the update won't be applied when you add the language pack. You need to reinstall the update to apply language-specific changes. To avoid reinstalling updates, install language packs and Features on Demand before installing updates.

Language updates have a specific order they need to be installed in. For example, to enable Cortana, install, in order: Microsoft-Windows-Client-Language-Pack, then –Basic, then OCR, then Handwriting, then –Fonts, then –TextToSpeech, and then –Speech.

Add languages

Mount the Languages and Optional Features ISO. When we add language components and Features on Demand, we'll use the mounted ISO as the source for these packages. Using the Languages and Optional Features ISO as the source ensures that FODs in your image get updated to include language resources for the languages you add. The examples below use F:\ as the location of the mounted Languaes and Optional Features ISO.

  1. Add the German language pack.

    Use the language packs and Features on Demand from the Languages and Optional Features ISOs:

    Dism /Add-Package /Image:C:\mount\windows /PackagePath:F:\LanguagesAndOptionalFeatures\Microsoft-Windows-Client-Language-Pack_x64_de-de.cab 
    
  2. Add the associated language Features on Demand

    Dism /Add-Capability /Image:C:\mount\windows /CapabilityName:Language.Basic~~~de-DE~0.0.1.0 /CapabilityName:Language.OCR~~~de-DE~0.0.1.0 /CapabilityName:Language.Handwriting~~~de-DE~0.0.1.0 /CapabilityName:Language.TextToSpeech~~~de-DE~0.0.1.0 /CapabilityName:Language.Speech~~~de-DE~0.0.1.0 /Source:F:\LanguagesAndOptionalFeatures
    
  3. (Optional) Add Japanese language packs and features on demand.

    Some language-specific fonts were separated out into different language components. In this section, we'll add the ja-JP language along with support for Japanese fonts.

    Use the language packs and Features on Demand from the 64-bit ISOs:

    1. Add the Japanese langauge pack:
    Dism /Add-Package /Image:C:\mount\windows /PackagePath:F:\LanguagesAndOptionalFeatures\Microsoft-Windows-Client-Language-Pack_x64_ja-jp.cab 
    
    1. Add the Japanese Language Features on Demand
    Dism /Add-Capability /CapabilityName:Language.Basic~~~ja-JP~0.0.1.0 /CapabilityName:Language.OCR~~~ja-JP~0.0.1.0 /CapabilityName:Language.Handwriting~~~ja-JP~0.0.1.0 /CapabilityName:Language.Fonts.Jpan~~~und-JPAN~0.0.1.0 /CapabilityName:Language.TextToSpeech~~~ja-JP~0.0.1.0 /CapabilityName:Language.Speech~~~ja-JP~0.0.1.0 /Source:F:\LanguagesAndOptionalFeatures
    
  4. Verify that the language packs are now part of the mounted images:

    dism /get-packages /image:"C:\mount\windows"
    

    Make sure that the added languages are on the list.

    Package Identity : Microsoft-Windows-Client-LanguagePack  ...  de-DE~10.0.22000.1
    State : Installed
    
  5. Verify that the Features on Demand are in your image:

    dism /get-capabilities /image:"C:\mount\windows"
    

    Make sure that the language FODs are in the list:

    Capability Identity : Language.Basic~~~de-de~0.0.1.0
    State : Installed
    ...
    Capability Identity : Language.Handwriting~~~de-de~0.0.1.0
    State : Installed
    

Configure language settings

This section covers how to change the default language and timezone of your mounted Windows image.

  1. Use DISM to set the default language of the image. We'll set the default language to German, since we added it into our image in the previous steps.:

    Dism /Image:C:\mount\windows /Set-AllIntl:de-DE
    
  2. Verify your changes

    Dism /Image:C:\mount\windows /Get-Intl
    

Set the default timezone

You can use DISM to set the default timezone for a PC. Here we'll set the time zone. See Default time zones for a list of available time zones.

Dism /Set-TimeZone:"W. Europe Standard Time" /Image:"C:\mount\windows"

Remove the base language from the image

This section covers removing a language from the Windows image. This is an optional step.

Now that our image has been set to use German as the default language, we can remove the English language features from it and make it a non-English image. To remove en-US completely from the image, you'll have to remove several components.

Warning

Don't remove the English base language if you're shipping a PC in English.

For removing the language components from a 64-bit image:

dism /image:"c:\mount\windows" /remove-package /packagename:Microsoft-Windows-Client-LanguagePack-Package~31bf3856ad364e35~amd64~en-US~10.0.22000.1 /packagename:Microsoft-Windows-LanguageFeatures-Basic-en-us-Package~31bf3856ad364e35~amd64~~10.0.22000.1 /packagename:Microsoft-Windows-LanguageFeatures-Handwriting-en-us-Package~31bf3856ad364e35~amd64~~10.0.22000.1 /packagename:Microsoft-Windows-LanguageFeatures-OCR-en-us-Package~31bf3856ad364e35~amd64~~10.0.22000.1 /packagename:Microsoft-Windows-LanguageFeatures-Speech-en-us-Package~31bf3856ad364e35~amd64~~10.0.22000.1 /packagename:Microsoft-Windows-LanguageFeatures-TextToSpeech-en-us-Package~31bf3856ad364e35~amd64~~10.0.22000.1 /packagename:Microsoft-Windows-RetailDemo-OfflineContent-Content-en-us-Package~31bf3856ad364e35~amd64~~10.0.22000.1

Tip

Troubleshooting: If an error occurs when running these commands, try the command again on the package that failed. Example:

Error: 0x800f0825
Package Microsoft-Windows-LanguageFeatures-Basic-en-us-Package may have failed due to pending updates to servicing components in the image.

If the command completes with errors, check the DISM log file. at C:\windows\Logs\DISM\dism.log.

Add languages to Windows RE

Here we'll show you how to add languages to WinRE. Adding languages to WinRE ensures that the language that a customer expects is available in recovery scenarios. Follow these steps if you added languages to your Windows image.

The examples below use packages from the mounted Languages and Optional Features ISO, and also from the ADK:

  1. Add German language packages

    Use the 64-bit versions of language packs and WinPE optional components:

    Dism /image:F:\Windows Preinstallation Environment\x64\WinPE_OCs\de-de\lp.cab"
    Dism /image:C:\mount\winre /add-package /packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\de-de\WinPE-Rejuv_de-de.cab"
    Dism /image:C:\mount\winre /add-package /packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\de-de\WinPE-EnhancedStorage_de-de.cab"
    Dism /image:C:\mount\winre /add-package /packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\de-de\WinPE-Scripting_de-de.cab"
    Dism /image:C:\mount\winre /add-package /packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\de-de\WinPE-SecureStartup_de-de.cab"
    Dism /image:C:\mount\winre /add-package /packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\de-de\WinPE-SRT_de-de.cab"
    Dism /image:C:\mount\winre /add-package /packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\de-de\WinPE-WDS-Tools_de-de.cab"
    Dism /image:C:\mount\winre /add-package /packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\de-de\WinPE-WMI_de-de.cab"
    Dism /image:C:\mount\winre /add-package /packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\de-de\WinPE-StorageWMI_de-de.cab"
    Dism /image:C:\mount\winre /add-package /packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\de-de\WinPE-HTA_de-de.cab"
    
  2. (Optional) Add Japanese language packs and font support to WinRE. Note that for Japanese, we will add an additional cab that is for font support.

    Use the language packs and WinPE optional components from the 64-bit ISOs:

    Dism /image:C:\mount\winre /add-package /packagepath:"F:\Windows Preinstallation Environment\x64\WinPE_OCs\ja-jp\lp.cab"
    Dism /image:C:\mount\winre /add-package /packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\ja-jp\WinPE-Rejuv_ja-jp.cab"
    Dism /image:C:\mount\winre /add-package /packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\ja-jp\WinPE-EnhancedStorage_ja-jp.cab"
    Dism /image:C:\mount\winre /add-package /packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\ja-jp\WinPE-Scripting_ja-jp.cab"
    Dism /image:C:\mount\winre /add-package /packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\ja-jp\WinPE-SecureStartup_ja-jp.cab"
    Dism /image:C:\mount\winre /add-package /packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\ja-jp\WinPE-SRT_ja-jp.cab"
    Dism /image:C:\mount\winre /add-package /packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\ja-jp\WinPE-WDS-Tools_ja-jp.cab"
    Dism /image:C:\mount\winre /add-package /packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\ja-jp\WinPE-WMI_ja-jp.cab"
    Dism /image:C:\mount\winre /add-package /packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\ja-jp\WinPE-StorageWMI_ja-jp.cab"
    Dism /image:C:\mount\winre /add-package /packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\ja-jp\WinPE-HTA_ja-jp.cab"
    Dism /image:C:\mount\winre /add-package /packagepath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\ja-jp\WinPE-FontSupport-JA-JP.cab"
    
  3. Set the default language for WinRE to match the default Windows language.

    Dism /Image:C:\mount\winre /Set-AllIntl:de-DE
    

Remove the base languages from WinRE (Optional)

Similar to removing the base language in install.wim, we can remove the base language from WinRE as well.

For removing language components from a 64-bit image:

Dism /image:"c:\mount\winre" /remove-package /packagename:Microsoft-Windows-WinPE-LanguagePack-Package~31bf3856ad364e35~amd64~en-US~10.0.22000.1 /packagename:WinPE-EnhancedStorage-Package~31bf3856ad364e35~amd64~en-US~10.0.22000.1 /packagename:WinPE-HTA-Package~31bf3856ad364e35~amd64~en-US~10.0.22000.1 /packagename:WinPE-Rejuv-Package~31bf3856ad364e35~amd64~en-US~10.0.22000.1 /packagename:WinPE-Scripting-Package~31bf3856ad364e35~amd64~en-US~10.0.22000.1 /packagename:WinPE-SecureStartup-Package~31bf3856ad364e35~amd64~en-US~10.0.22000.1 /packagename:WinPE-SRT-Package~31bf3856ad364e35~amd64~en-US~10.0.22000.1 /packagename:WinPE-StorageWMI-Package~31bf3856ad364e35~amd64~en-US~10.0.22000.1 /packagename:WinPE-WDS-Tools-Package~31bf3856ad364e35~amd64~en-US~10.0.22000.1 /packagename:WinPE-WMI-Package~31bf3856ad364e35~amd64~en-US~10.0.22000.1

Driver Packages

You should add driver packages to ensure Windows can successfully boot for the first time and can connect to the Internet and to Windows Update. The image should not rely on any third-party inbox driver packages for your hardware. Make sure that you add your driver package to the right image:

  • Universal driver packages: Driver packages that meet the Universal driver package requirements can generally be installed more quickly and reliably, leading to an improved manufacturing experience.
  • Boot-critical driver packages: Storage driver packages and other packages that are needed to successfully boot the system may sometimes need to be added to the Windows image (as shown in this lab), Windows PE image, and in the WindowsRE image.
  • Other important driver packages: Graphics driver packages may sometimes need to be added to the Windows image (as shown in this lab), Windows PE image, and in the WindowsRE image.

The following shows how to add driver packages in various ways.

Tip

If you're creating several devices with identical hardware configurations, you can speed up installation time and first boot-up time by maintaining driver configurations when capturing a Windows image.

Add drivers to your Windows image

  1. Add a single driver package. In this example, we're using a driver named media1.inf:

    Dism /Add-Driver /Image:"C:\mount\windows" /Driver:"C:\Drivers\PnP.Media.V1\media1.inf"
    

    Where "C:\Drivers\PnP.Media.V1\media1.inf" is the INF file for your driver package.

  2. If you want to add an entire folder of driver packages, you can use the /Recurse option. This adds all driver packages in the folder and all its subfolders.

    Warning

    While /Recurse can be handy, it's easy to bloat your image with it. Some driver package folders include multiple driver packages, which often share payload files from that same folder. During installation, each driver package is expanded into a separate folder, each with a copy of the payload files. We've seen cases where a popular driver package in a 900MB folder added 10GB to images when added with the /Recurse option.

    Dism /Add-Driver /Image:"C:\mount\windows" /Driver:c:\drivers /Recurse
    
  3. Verify that the driver packages are part of the image:

    Dism /Get-Drivers /Image:"C:\mount\windows"
    

    Check the list of packages and verify that the list contains the driver packages you added.

Add drivers to your WinRE image

If you added driver packages to your Windows image, you should also add them to your WinRE image. Adding driver packages to your recovery image ensures they are available during recovery scenarios. Adding driver packages to a WinRE image is the same process as adding driver packages to a regular Windows image.

Dism /Add-Driver /Image:"C:\mount\winre" /Driver:"C:\Drivers\PnP.Media.V1\media1.inf" /LogPath=C:\mount\dism.log

Note

You can use the /recurse option to add an entire folder of driver packages

Updates

While your image is mounted, you can add Windows updates. The process is similar to the one we used to add driver packages earlier.

Reminder:

  • Add languages before major updates. Major updates include hotfixes, general distribution releases, or service packs. If you add a language later, you'll need to re-add the updates.
  • Add major updates before apps. These apps include universal Windows apps and desktop applications. If you add an update later, you'll need to re-add the apps.
  • For major updates, update the recovery image too: These may include hotfixes, general distribution releases, service packs, or other pre-release updates. We'll show you how to update these later in Lab 12: Update the recovery image.
  • If a Servicing Stack Update (SSU) is required, you'll have to apply it before applying the most recent General Distribution Release or any future GDRs.

Add Windows updates to your image

Use DISM to apply the latest servicing stack update (SSU), Latest cumulative update (LCU), ZDP updates, or any prerequisite KB updates.

Important

If you install an update that contains language-dependent resources prior to installing a language pack, the language-specific changes in the update won't be applied when you add the language pack. You need to reinstall the update to apply language-specific changes. To avoid reinstalling updates, install language packs before installing updates.

  1. Get a Windows update package. Extract the .msu file update to a folder, for example, E:\updates\windowsupdatename.msu. Make sure that your update matches the architecture of the image you are working with.

  2. Add the msu to your mounted image using dism /add-package.

    Dism /Add-Package /Image:C:\mount\windows /PackagePath:"E:\updates\windows10.0-kb4000001-x64.msu"
    

    You can also add multiple updates in the same command:

    Dism /Add-Package /Image:C:\mount\windows /PackagePath:"E:\updates\windows10.0-kb4000001-x64.msu" /PackagePath:"E:\updates\windows10.0-kb0000002-x64.msu"
    

    Note

    Each package is typically a new KB that increases the build revision number of Windows. You can find the revision number of windows in the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\UBR

  3. Lock in the update to ensure it get restored during recovery.

    DISM /Cleanup-Image /Image=C:\mount\windows /StartComponentCleanup /ScratchDir:C:\Temp
    
  4. Verify that the updates are in the image.

    Dism /Image:C:\mount\windows /Get-Packages
    

    Review the resulting list of packages and verify that the list contains the package. For example:

    Package Identity : Package_for_RollupFix~31bf3856ad364e35~amd64~~22000.250.1.1
    State : Installed
    Release Type : Security Update
    Install Time : 04/29/2017 6:26 PM
    The operation completed successfully.
    

Add Update packages to WinRE

In this section, we cover how to add updates to the WinRE image.

Important

You have to apply cumulative updates to your WinRE image in addition to your Windows image. Because updates are cumulative, when a new update is installed, old updates can be removed. The WinRE optimization that we cover later in the lab will remove unnecessary updates which will keep the WinRE image from growing in size.

To apply the update that you downloaded in the previous section to your WinRE image, you have to run dism /add-package to apply the update to the mounted WinRE image.

Dism /Add-Package /Image:C:\mount\winre /PackagePath:"E:\updates\windows10.0-kb4000001-x64.msu"

Apps and features

Apps

This section covers working with Apps, including reinstalling inbox apps after updates, how to add Microsoft Store apps, and how to add Microsoft Office.

This section continues to use your mounted Windows image. If your image isn't still mounted, mount it.

Reminder: Install apps only after you have installed languages and updates, in that order.

Reinstall inbox apps

Now that you've added languages and updates to your image, you have to reinstall the apps that come with Windows. This makes sure that the apps will work and include the languages you have added to your image. To reinstall these apps, you'll need the App update OPK or the inbox Apps ISO.

  1. Copy the amd64fre folder on the inbox apps ISO to c:\temp\lab\apps\inbox\
  2. Reinstall the inbox apps to ensure that the apps have the language resources they need. The Sample scripts page has a sample script, but it's only a sample and doesn't necessarily reinstall all of the inbox apps in an image. Make sure to use your own script that includes all the apps on your device.

Your apps are now ready to work with your image.

Add a Microsoft Store app

To complete this section, you'll need to have the App update OPK or the inbox apps ISO. Whichever you are using, we'll refer to it as the App update OPK in the following steps.

  1. Use DISM to add the HEVC codec .appx from the files you extracted in the previous section.

  2. Install the HEVC .appx:

    DISM /Add-ProvisionedAppxPackage /Image:c:\mount\windows /PackagePath:"C:\temp\lab\apps\amd64\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.x64.appx" /licensepath:"C:\temp\lab\apps\inbox\amd64\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.x64.xml" /DependencyPackagePath:"C:\temp\lab\apps\inbox\amd64\Microsoft.VCLibs.x64.14.00.appx"
    
  3. Use DISM /Add-ProvisionedAppxPackage to add any additional apps to your image.

  4. Verify that the apps are installed:

    Dism /Image:"C:\mount\windows" /Get-ProvisionedAppxPackages
    

Optimize your installed apps

You can reduce app disk usage by running DISM /Optimize-ProvisionedAppxPackages after you install apps. This command will only work when run against an offline image:

DISM.exe /Image:"C:\mount\windows" /Optimize-ProvisionedAppxPackages

Preinstall Microsoft Office

Follow the instructions in the latest Office OEM Preinstallation guide for instructions to learn which Office version to preinstall, and how to install it.

Features on Demand

Add a Feature on Demand (FOD) to your Windows image. Features on Demand are features that you can choose to preinstall. You can see a list of available FODs, and recommendations for preinstallation here.

Here we'll show you how to preinstall the .Net Framework Feature on Demand.

Note

While it's possible to add some FODs using the /add-package option, using DISM /Add-Capability is the recommended way to add FODs.

  1. If it's not still mounted, mount the Languages and Optional Features ISO

  2. On your technician PC, use DISM to get a list of available FODs in an image:

    dism /image:C:\mount\windows /get-capabilities
    

    This will show a list of available capabilities.

  3. Add the .NET framework.

    dism /image:C:\mount\windows /add-capability /capabilityname:NetFX3~~~~ /Source:F:\LanguagesAndOptionalFeatures
    

    Where F: is the mounted FOD ISO, and NetFX3~~~~ is the the .NET framework capability name.

    .NET framework is now added to your image.

  4. If you have additional FODs to include in your image, add them.

Start menu and Taskbar

Customize Start menu pins

Modify the Start layout

OEMs can customize the Start layout so that OEM-defined items (apps and/or websites) are pinned in certain areas of the Start menu.

Start layout customizations are configured with LayoutModification.json and, optionally, LayoutModification.xml:

  • LayoutModification.json provides full support for app pins
  • LayoutModification.xml enables adding website pins to LayoutModification.json

Note

You can't use Windows Configuration Designer or Unattend to configure the Windows 11 Start Menu.

See Customize the Windows 11 Start menu

Customizable sections

Pinned section

The section at the top of the Start menu is called the Pinned section. This section consists of pins arranged in a grid. The items in this section are a subset of all the apps installed on the PC; not all installed apps are included in this section by default. The number of rows and items in this view are consistent across device panel sizes.

While the initial view of this section displays 18 items, a user can use the pagination control to move through pages of additional pins. The items in this section are a combination of Microsoft-defined apps, dynamically delivered apps, and OEM-configured items. After setting up their PC, users can add, move, or remove pins in this this section.

Available customizations:

  • Up to four items on page 1 of this section. Configured with primaryOEMPins in LayoutModification.json.
  • Up to four items at the bottom of the pinned app grid. Users need to scroll down in the Start menu to see these pins. Configured with secondaryOEMPins in LayoutModification.json.

If you pin fewer than four items in either of these sections, other Microsoft-defined apps will slide over to fill the space to maintain the same order. Any array elements beyond the first four will be ignored.

Note

An item can only appear in the Pinned section once. It's not possible to pin an app in more than one location in this section, whether on the same page or on different pages.

This is the section below the "Pinned" section. On first boot, the Get Started app from Microsoft will be pre-populated in this location. An OEM can also pre-populate the section with a welcome or first run experience app that will stay pinned for up to seven days unless a customer removes it.

Available customizations: One item in this section. Configured with firstRunOEMPins in LayoutModification.json.

  • For the best and cleanest user experience, we recommend that the app chosen for the Recommended section is not pre-pinned to the taskbar or first page of Start pins.

Add pins to the Start menu

This section shows how to add pins to the customizable areas of the Start menu.

  • To pin UWP apps, you'll need to know their AUMID.
  • If you're pinning a web link, you'll need to create a web link tile using a Windows 10 PC, and then export the layout that includes the web link. See Export the Start Layout to learn how to export a Start Layout.
  • Unpackaged Win32 apps use .lnk files that point to the app.
  1. On your technician PC, create an empty file called LayoutModification.json.

  2. Paste the following empty LayoutModification.json into the file you created in the previous step:

    { "primaryOEMPins": [ 
      ], 
      "secondaryOEMPins": [ 
      ], 
      "firstRunOEMPins": [ 
      ] 
    } 
    
  3. Customize each section to add apps by adding JSON members for the types of apps you want to pin.

    1. We'll start by pinning the Command prompt as a primary OEM pin. Since the Command prompt is an unpackaged Win32 app, it gets added as a desktopAppLink:
    { "primaryOEMPins": [ 
        { "desktopAppLink": "%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\System Tools\\Command Prompt.lnk"}
      ], 
      "secondaryOEMPins": [ 
      ], 
      "firstRunOEMPins": [ 
      ] 
    } 
    
    1. Next, we'll add a UWP app as a Secondary OEM pin, using its AUMID and adding it using packagedAppID. This pin will appear at the end of the Start menu. Here's a sample UWP app added to our layout:
    { "primaryOEMPins": [ 
        { "desktopAppLink": "%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\System Tools\\Command Prompt.lnk"}
      ], 
      "secondaryOEMPins": [ 
        { "packagedAppId": "OEM.App1_1abcde2f3ghjk!App"}
      ], 
      "firstRunOEMPins": [ 
      ] 
    } 
    
    1. Finally, we'll add an app to the Recommended section. You can add one app to this section. The app you pin won't be permanent; it will disappear over time as the PC is used and new items populate the Recommended section:
    { "primaryOEMPins": [ 
        { "desktopAppLink": "%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\System Tools\\Command Prompt.lnk"}
      ], 
      "secondaryOEMPins": [ 
        { "packagedAppId": "OEM.App1_1abcde2f3ghjk!App"}
      ], 
      "firstRunOEMPins": [ 
        { "desktopAppLink": "%ALLUSERSPROFILE%\\Microsoft\\Windows\\Start Menu\\Programs\\PutMeInRecommended.lnk" }
      ] 
    } 
    
  4. If you want to create Web links to add to your Start menu:

    To pin a web link to the Start menu, you'll need to have both LayoutModification.json and LayoutModification.xml files.

    Web links use both LayoutModification.xml and LayoutModification.json. Each web link that's specified in LayoutModification.json must have a corresponding SecondaryTile element in LayoutModification.xml:

    • LayoutModification.xml is used to configure the web link
    • LayoutModification.json references the configured web link

    Use your exported Start layout to pin a web link

    Your exported Start layout will contain SecondaryTile elements for each of the web links you've configured. Make note of the AppUserModelID and TileID elements. You'll add these to your LayoutModification.json to pin the web link.

    Example web pin

    Below is an example of a web pin from a LayoutModification.xml:

    <start:SecondaryTile 
    AppUserModelID="Microsoft.MicrosoftEdge.Stable_8wekyb3d8bbwe!App" 
    TileID="MSEdge.anfoedbkjbcacemdbigf.UserData.Default" 
    Arguments="--launch-tile --profile-directory=Default --app-id=anfoedbkjbhcfgooaffkopcacemdbigf --app-url=https://www.bing.com/" 
    DisplayName="(Text of your choice to display in Start)" 
    Square150x150LogoUri="msappdata:///local/Favicons/Taskbar/‌anfoedbkjbhcfgooaffkopcacemdbigf/largefavicon.png" 
    Wide310x150LogoUri="ms-appx:///" 
    ShowNameOnSquare150x150Logo="true" 
    ShowNameOnWide310x150Logo="false" 
    BackgroundColor="#000000" 
    Size="2x2" 
    Row="0" 
    Column="0"/> 
    

    Add this tile to LayoutModification.json by adding a new JSON object in the section you want to add the pin:

    • Use the attribute from AppUserModelID ("Microsoft.MicrosoftEdge.Stable_8wekyb3d8bbwe!App") for the packageAppID value in LayoutModification.json.
    • Use the attribute from TileID ("MSEdge.anfoedbkjbcacemdbigf.UserData.Default") for the tileID value in LayoutModification.json.

    Here's what it looks like, using the above example, to pin the web link to the bottom of the "Pinned" section:

    ... 
    "secondaryOEMPins": [ 
      { "packagedAppId": "Microsoft.MicrosoftEdge.Stable_8wekyb3d8bbwe!App", 
        "tileId": "MSEdge.anfoedbkjbcacemdbigf.UserData.Default" }, 
      ], 
    ...
    

    You can pin additional items to the Start menu. Here's an example of a LayoutModification.json that includes multiple items in each section:

    { "primaryOEMPins": [ 
        { "packagedAppId": "OEM.App1_1abcde2f3ghjk!App"}, 
        { "desktopAppLink": "%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\System Tools\\Command Prompt.lnk"}, 
        { "packageAppId": "Microsoft.MicrosoftEdge.Stable_8wekyb3d8bbwe!App", 
            "tileId": "MSEdge.paomdnjincdkenhiicpl.UserData.Default"} 
        ], 
        "secondaryOEMPins": [ 
        { "packagedAppId": "Microsoft.MicrosoftEdge.Stable_8wekyb3d8bbwe!App", 
        "tileId": "MSEdge.anfoedbkjbcacemdbigf.UserData.Default" }, 
        { "desktopAppId": "Contoso.Desktop.Example.AUMID"} 
        ], 
        "firstRunOEMPins": [ 
        { "desktopAppLink": "%ALLUSERSPROFILE%\\Microsoft\\Windows\\Start Menu\\Programs\\PutMeInRecommended.lnk", 
            "caption": { 
            "en-US": "(localized caption text for US English)", 
            "de": "(localized caption text for German)", 
            "default": "(fallback caption text for other languages)" } 
        } 
        ] 
    } 
    
Add the layout to your image
  1. Copy your LayoutModification.json and, if you pinned web links, your LayoutMofification.xml to your mounted image. Windows looks for these files in the \Windows\Users\Default\Appdata\Local\Microsoft\Windows\Shell folder. If this folder already contains layoutmodification files, replace the existing file(s) with the new one(s);

    xcopy /s LayoutModification.json C:\Mount\Users\Default\Appdata\Local\Microsoft\Windows\Shell
    xcopy /s LayoutModification.xml C:\Mount\Users\Default\Appdata\Local\Microsoft\Windows\Shell
    
  2. If you're done customizing your image, unmount it with committing changes.

    dism /unmount-image /mountdir:C:\mount /commit
    

    Otherwise, keep the image mounted and go to the next section

Customize the Taskbar layout

You can pin up to three items to the Taskbar. To pin Taskbar items, you need to create a custom TaskbarLayoutModification.xml file and then set a registry key that defines the location of your Taskbar layout file.

See Customize the Windows 11 Taskbar

  1. Below is an empty Taskbar layout file. Copy the contents into a file called TaskbarLayoutModification.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <LayoutModificationTemplate
    xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification"
    xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout"
    xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout"
    xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout"
    Version="1">
    
    <CustomTaskbarLayoutCollection PinListPlacement="Replace">
        <defaultlayout:TaskbarLayout>
            <taskbar:TaskbarPinList>
                <taskbar /> 
                <taskbar />
            </taskbar:TaskbarPinList>
        </defaultlayout:TaskbarLayout>
    </CustomTaskbarLayoutCollection>
    </LayoutModificationTemplate>
    
  2. Pin a Classic Windows application:

    To add a Classic Windows application, add a <taskbar:DesktopApp> element with a DesktopApplicationLinkPath attribute that specifies the path to a shortcut (.lnk) file. We recommend using the same shortcut .lnk files in the All Users Start menu. Example:

    <taskbar:TaskbarPinList>
    <taskbar:DesktopApp DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\System Tools\Command Prompt.lnk"/>
    </taskbar:TaskbarPinList>
    

    Note

    Some classic Windows applications are now packaged differently than they were in previous versions of Windows. See Notepad and Paint to learn more.

  3. Add a UWP app. For Universal Windows apps, add a <Taskbar:UWA> element with a AppUserModelID attribute that specifies the a Universal Windows app's user model ID (AUMID). Example:

    <taskbar:TaskbarPinList>
    <taskbar:UWA AppUserModelID="Microsoft.Windows.Photos_8wekyb3d8bbwe!App"/>
    </taskbar:TaskbarPinList>
    

    See Find the Application User Model ID of an installed app to learn how to find the AUMID of an installed app.

  4. Save the file as C:\Mount\Windows\OEM\TaskbarLayoutModification.xml.

  5. Later in Audit more, we'll add a registry key to define where the TaskbarLayoutModification is saved.

Add a license agreement and info file

Add an OEM-specific license

In this section, we'll cover how an OEM can add their own license terms during OOBE.

Note

If the license terms are included, the OEM must include a version of the license terms in each language that is preinstalled onto the PC. A license term text must be an .rtf file, and have an .html file with a matching name in the same folder. See OEM license terms for more information on license files.

To begin adding license terms, you'll have to create folders for your license files, and then configure OOBE to show the license on first boot.

  1. Create folders for your system languages under the following directory: C:\mount\windows\Windows\System32\oobe\info\default\

  2. Name each folder under the C:mount\windows\Windows\System32\oobe\info\default\ directory as the Language Decimal Identifier that corresponds to the language. Do this step for each language pack that's in the Windows image.

    Note: Please see this link to see complete list of language decimal identifiers of corresponding languages.

    For example, if en-us and de-de language packs are added to the Windows image, add a folder named "1033" (representing en-us language) in C:\mount\windows\Windows\System32\oobe\info\default. Then add a folder named "1031" (de-de language) under the same C:\mount\windows\Windows\System32\oobe\info\default\ directory.

    MD c:\mount\windows\windows\system32\oobe\info\default\1031
    MD c:\mount\windows\windows\system32\oobe\info\default\1033
    
  3. Create a license terms .rtf file for each language you have in your image, and copy them to the language-specific oobe folder.

    For example: Move the English agreement.rtf file to C:\mount\windows\Windows\System32\oobe\info\default\1033\ directory and move the German agreement.rtf to C:\mount\windows\Windows\System32\oobe\info\default\1031.

    copy E:\resources\english-agreement.rtf c:\mount\windows\windows\system32\oobe\info\default\1033\agreement.rtf
    copy E:\resources\german-agreement.rtf c:\mount\windows\windows\system32\oobe\info\default\1031\agreement.rtf
    
  4. Open a text editor and create .html versions of your license terms. Save the terms to the same folders as the .rtf versions. You can use the EULA example from OEM license terms to create sample files. The names of the EULA files should be identical, except for the extension.

    C:\mount\windows\windows\system32\oobe\info\default\1033\agreement.html  (English version)
    C:\mount\windows\windows\system32\oobe\info\default\1031\agreement.html  (German version)
    
  5. Create an oobe.xml file to specify the license agreement.rtf file path. Windows will automatically find the accompanying .html file. Below is a sample oobe.xml.

     <FirstExperience>
    <oobe>
        <oem>
            <eulafilename>agreement.rtf</eulafilename>
        </oem>
    </oobe>
    </FirstExperience>
    
  6. Copy oobe.xml file to `C:\mount\windows\windows\system32\oobe\info\

  7. Copy oobe.xml to the laguage-specific folders you created earlier.For example: Copy oobe.xml to C:\mount\windows\Windows\System32\oobe\info\default\1033, which has a file called agreement.rtf in English. To add the German agreement, copy oobe.xml to C:\mount\windows\Windows\System32\oobe\info\default\1031\ directory, which has the German agreement.rtf file.

    copy E:\configset\oobe.xml c:\mount\windows\windows\system32\oobe\info\default\1033
    copy E:\configset\oobe.xml c:\mount\windows\windows\system32\oobe\info\default\1031
    
  8. Now each language folder has an oobe.xml, agreement.rtf, and agreement.thml file in that corresponding language.

When the image first boots into OOBE, it will display the license agreement.

Create an image info file and add it to your image

  • Create an csup.txt file to specify when the Windows image was created. This file must include the date that the image was created, in the form of 'MM-DD-YYYY', with no other characters, on a single line at the top of the file. This command will create the file:

    echo 6-24-2021 >"C:\mount\windows\Windows\csup.txt"
    

Customize Windows with an answer file

Answer files (or Unattend files) can be used to modify Windows settings in your images during Setup. You can also create settings that trigger scripts in your images that run after the first user creates his/her account and picks the default language. Answer files allow you specify various setup options, including how to partition disks, the location of the Windows image to install, and the product key to apply. Values that apply to the Windows installation, such as the names of user accounts, display settings, and Internet Explorer Favorites can also be specified. The answer file for Setup is typically called Unattend.xml.

Unattend files include several sections, each of which are processed at different times throughout the Windows installation process. These phases are called configuration passes. Here are the most often-used passes:

You can specify which configuration pass to add new settings to:

  • 1 - windowsPE: These settings are used by the Windows Setup installation program. If you're modifying existing images, you can usually ignore these settings.
  • 2 - offlineServicing: Settings in offlineServicing are processed when DISM is used to apply an unattend file to an offline image.
  • 4 - specialize: Most settings should be added here. These settings are triggered both at the beginning of audit mode and at the beginning of OOBE. If you need to make multiple updates or test settings, generalize the device again and add another batch of settings in the Specialize Configuration pass.
  • 6 - auditUser: Runs as soon as you start audit mode. AuditUser is a good place to run a system test script. We'll add Microsoft-Windows-Deployment\RunAsynchronousCommand as our example. To learn more, see Add a Custom Script to Windows Setup.
  • 7 - oobeSystem: Use sparingly. Most of these settings run after the user completes OOBE. The exception is the Microsoft-Windows-Deployment\Reseal\Mode = Audit setting, which we'll use to bypass OOBE and boot the PC into audit mode. If your script relies on knowing which language the user selects during OOBE, you'd add it to the oobeSystem pass.

While you can set many Windows settings in audit mode, some settings can only be set by using an answer file or Windows Configuration Designer, such as adding manufacturer's support information. A full list of answer file settings (also known as Unattend settings) is in the Unattended Windows Setup reference.

Make an answer file

Use Windows System Image Manager (SIM) to create and modify unattend files. SIM is installed as part of the ADK. Make sure that your answer settings include the required settings as outlined in the OEM Policy Document.

Create a catalog file in Windows SIM

Catalog files (.clg) are files with information about settings that are applicable to a particular Windows image. When working with a Windows image in SIM, you have to first create a catalog file for the Windows WIM you're working with.

  1. Start Windows System Image Manager (WSIM).
  2. Click File > Select Windows Image.
  3. In Select a Windows Image, browse to and select the image file (D:\install.wim).
  4. Select the Home edition click OK.
  5. Click Yes to create the catalog file. Windows SIM creates the file based on the image file, and saves it to the same folder as the image file. This process can take several minutes.

The catalog file appears in the Windows Image pane. Windows SIM lists the configurable components and packages in that image.

Create an answer file

If you're not working with the existing unattend file, you can create a new one in Windows SIM:

  • Click file > New Answer File

The new answer file will appear in the right-pane.

Add answer file settings

In this section, we'll show you how to create an answer file that can configure settings when you deploy your Windows image.

Before you start, create a folder called Panther in your mounted Windows image. Windows will automatically look in this folder for an answer file.

md c:\mount\windows\Windows\panther
Add OEM info (optional)
  1. In the Windows Image pane, expand Components, right-click amd64_Microsoft-Windows-Shell-Setup_(version), and then select Add Setting to Pass 4 specialize.

  2. In the Answer File pane, select Components\4 specialize\amd64_Microsoft-Windows-Shell-Setup_neutral\OEMInformation.

  3. In the OEMInformation Properties pane, in the Settings section, set:

    Manufacturer=Fabrikam
    Model=Notebook Model 1
    Logo=C:\Windows\Fabrikam\Fabrikam.bmp
    
  4. Save the answer file in the Panther folder as c:\temp\lab\AnswerFiles\unattend.xml.

Next you'll have to make sure that the logo you specified above is in your Windows image.

  1. Create a 32-bit color image with a maximum size of 120x120 pixels. Save it as C:\temp\labAnswerFiles\Fabrikam.bmp file on your Technician PC.

  2. Create a folder in your mounted Windows image called Fabrikam.

    mkdir c:\mount\windows\Fabrikam
    
  3. Copy Fabrikam.bmp to the Fabrikam folder you just created:

    copy fabrikam.bmp c:\mount\windows\fabrikam
    
Set the device to automatically boot to audit mode

Using the same unattend.xml file, set the PC to automatically boot into Audit mode.

  1. In the Windows Image pane, expand Components, right-click amd64_Microsoft-Windows-Deployment_(version), and then select Add Setting to Pass 7 oobeSystem.
  2. In the Answer File pane, select Components\7 oobeSystem\amd64_Microsoft-Windows-Deployment_neutral\Reseal.
  3. In the Reseal Properties pane, in the Settings section, select Mode=Audit.
  4. Save the answer file in the Panther folder as unattend.xml.

Set the Windows edition

In this section, we will upgrade the Windows OS edition from Home to Pro.

Important

  • You cannot set a Windows image to a lower edition.
  • Note: You should not use this procedure on an image that has already been changed to a higher edition.
  • You wouldn't normally switch editions offline like we'll show you here. Instead of upgrading editions, you would've mounted a Windows Professional wim to begin with. This step is included here for instructional purposes; just to show you the use of the /Set-Edition command.
  1. Determine available editions by running the following command to determine what images you can upgrade the image to:

    Dism /Get-TargetEditions /Image:C:\mount\windows
    

    Note the edition IDs available.

  2. Upgrade the edition to the Professional edition.

    Dism /Set-Edition:Professional /Image:C:\mount\windows
    

Keep Windows settings through a recovery

In recovery scenarios, Windows doesn't automatically save settings created through with answer files, Windows Start Menu customizations created with LayoutModification.xml, or first-login info from oobe.xml.

To make sure Windows saves your customizations:

  • Save copies of unattend.xml, LayoutModification.json, TaskbarLayoutModification.xml plus your C:\mount\windows\Windows\System32\OOBE folder, in C:\Recovery\AutoApply\.

Optimize WinRE (part 1)

  1. Increase the scratchspace size of the WinRE image.

    Dism /image:c:\mount\winre /set-scratchspace:512
    
  2. Cleanup unused files and reduce the size of winre.wim

    dism /image:"c:\mount\winre" /Cleanup-Image /StartComponentCleanup
    

Unmount your images

  1. Close all applications that might be accessing files from the image, including File Explorer.

  2. Commit the changes and unmount the Windows RE image:

    Dism /Unmount-Image /MountDir:"C:\mount\winre" /Commit
    

    where C is the drive letter of the drive that contains the image.

    This process can take a few minutes.

  3. Make a backup copy of the updated Windows RE image and replace the old WinRE image with the newly exported one:

    dism /export-image /sourceimagefile:c:\mount\windows\windows\system32\recovery\winre.wim /sourceindex:1 /DestinationImageFile:c:\temp\lab\winre_bak.wim
    Del c:\mount\windows\windows\system32\recovery\winre.wim
    Copy c:\temp\lab\winre_bak.wim c:\mount\windows\windows\system32\recovery\winre.wim
    

    If prompted, specify F for file

    Troubleshoot: If you cannot see winre.wim under the specified directory, use the following command to set the file visible:

    attrib -h -a -s C:\mount\windows\Windows\System32\Recovery\winre.wim
    
  4. Check the new size of the Windows RE image:

    Dir "C:\mount\windows\Windows\System32\Recovery\winre.wim"
    
  5. Based on the size of the new winre.wim, adjust the partition sizes in the deployment scripts so they include enough room for winre.wim, as well as some additional free space.

    Follow the below partition layout size chart to determine the size of your recovery partition in the createpartitions-<firmware>-<imageformat>.txt files. The amount of free space left is after you copy winre.wim to the hidden partition. See the below disk partition rules for more information.

    Partition Size Free space
    Less than 500 MB Minimum 50 MB free
    450 MB - 680 MB Minimum 320 MB free
    More than 680 MB 1024 MB free

    Example of the recovery partition size from the createpartitions diskpart scripts.:

    rem == 3. Windows RE tools partition ===============
    create partition primary size=465
    
  6. Optimize the Windows image the same way you did with the WinRE image:

    Dism /Image:c:\mount\windows /Cleanup-Image /StartComponentCleanup
    
  7. Commit the changes and unmount the Windows image:

    Dism /Unmount-Image /MountDir:"C:\mount\windows" /Commit
    

    Where C is the drive letter of the drive that contains the image. This process may take several minutes.

  8. Finish optimizing your image by exporting the image. During the export process, DISM removes files that were superseded and the image will have a reduced file size. Export the Windows image into a new image file:

    Dism /Export-Image /SourceImageFile:"C:\temp\lab\Images\basicimage.wim" /SourceIndex:1 /DestinationImageFile:"C:\temp\lab\Images\install.wim"
    

You now have a customized Windows image that you can deploy to other PCs. In the next section, we'll show you how to deploy the image to your reference PC, make online changes, and then finalize the Windows image to get it ready for final deployment.

Deploy your images to a new PC

In this section we'll deploy an image to a PC so that it can be customized in Audit mode. Before you start this section:

  • Copy your customized images to the NTFS partition on your USB drive

    copy c:\temp\lab\images\install.wim e:\images
    copy c:\temp\lab\images\winre_bak.wim e:\images
    
  • Make sure the sample scripts are in the Deployment folder on your USB drive.

Boot to WinPE

If you're not already booted into WinPE on the device you're deploying your image to, boot into WinPE:

  1. Connect the USB key with the WinPE partition boot the reference computer.
  2. If you're using two separate USB drives, after WinPE has been booted connect the USB drive that has the images and deployment scripts.
  3. At the X:\Windows\system32> command line, type diskpart and press Enter.
  4. At the \DISKPART> command line type list volume.
  5. In the "Label" column, note the letter of the volume under the "Ltr" column. This is the drive letter of your USB key. (example E)
  6. Type exit to quit Diskpart

Use a deployment script to apply your image

Run a script to create partitions and apply your image. We'll use applyimage.bat in USBDrive\deployment to do this for us.

ApplyImage.bat uses diskpart scripts to create the partitions and define the partition layout. This script and the subscripts it calls must be placed in the same subfolder. You can update these scripts to change the partition sizes as you desire.

Note

If you're going to be capturing and deploying your final image as an FFU, choose the options to not configure recovery. This allows you to expand the Windows partition, if needed, after you apply your FFU. You can configure recovery after you expand the Windows partition.

  1. Run applyimage.bat and specify the image to apply:

    D:
    cd Deployment
    ApplyImage.bat D:\Images\install.wim
    

    Where D: is the drive letter of your script and image on your USB Storage drive.

    When prompted by the script:

    1. Choose whether or not to configure the recovery partition

      • Y: Configures the Windows recovery partition
      • N: Does not configure the recovery partition. The recovery partition can be configured later. Choose this option if you're going to be capturing and deploying your image as an FFU.
    2. Press Y to format the drive

    3. Choose N to not to deploy as Compact OS.

    4. Press N to indicate the image does not include extended attributes (EA)

      Note

      Only use compact OS on Flash drive based devices as compact OS performance is heavily dependent on the storage device capabilities. Compact OS is NOT recommended on rotational devices. Please reference Compact OS for more information.

  2. Remove the USB drive and reboot the reference PC.

    exit
    

    The PC should boot into Windows Audit mode based on the settings of the unattend file we created earlier. If you're not using an unattend.xml file that sets the PC to boot into Audit Mode, you can press Ctrl+Shift+F3 during OOBE to boot into Audit mode.

Make online customizations (audit mode)

Configure your TaskbarLayoutModification.xml location

  • Add the following registry key to define the location for the TaskbarLayoutModification.xml file you created earlier:

    cmd /c reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ /v LayoutXMLPath /d C:\Windows\OEM\TaskbarLayoutModification.xml

Additional customizations

You can use audit mode to customize Windows using the familiar Windows environment. In audit mode, you can add Windows desktop applications, change system settings, add data, and run scripts.

To make sure your audit mode changes are included in the recovery image, you'll need to capture these changes into a provisioning package using ScanState. This package gets used by the system recovery tools to restore your changes if things go wrong. You can optionally save drive space by running the applications directly from the compressed recovery files; this is known as single-instancing.

If you want to capture the changes in an image and apply it to other devices, you'll need to use Sysprep to generalize the image.

Verify Customizations in Audit Mode

We don't recommend connecting your PC to the internet during manufacturing, and also don't recommend isntalling updates from Windows Update in audit mode because it will likely generate an error during sysprep.

  1. After setup has finished, the computer logs into Windows in Audit mode automatically as an Administrator.
  2. Verify the changes from the answer file (see manufacturer name, support phone number and other customizations) are present.

Verify the edition

Earlier in the lab, we upgraded the edition from Windows Home to Windows Professional. Verify this change:

  1. Open Command Prompt as administrator

  2. Run:

    dism /online /get-current-edition
    
  3. Make sure it's the right edition. It should look like this:

    Current edition is:
    
    Current Edition : Professional
    
    The operation completed successfully.
    

Apps and Store opportunities

Through Windows and the Microsoft Store, you have tremendous opportunities for brand and device differentiation, revenue creation, and customer access.

Microsoft Store apps are at the center of the Windows experience. As an OEM, you can provide an engaging customer experience and increase brand loyalty by providing a great set of value-added software and services along with the high-quality hardware that you build.

Important

The key below must be set in Audit mode.

You have to change a registry setting to add your OEM ID. If you're an OEM Microsoft Store Program participant, contact reportapp@microsoft.com to get your OEM ID.

Item Location in Registry
OEMID HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Store, (REG_SZ) OEMID
SCM ID HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Store, (REG_SZ) StoreContentModifier

OEMID

  1. Run regedit.exe from Command Prompt
  2. Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Store
  3. Right click under (Defalut) -> click new
  4. Click String Value
  5. Type OEMID
  6. Double click OEMID and enter OEM name in Value data: text field

SCMID

  1. Run regedit.exe from Command Prompt
  2. Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Store
  3. Right click under (Defalut) -> click new
  4. Click String Value
  5. Type StoreContentModifier
  6. Double click StoreContentModifier and enter OEM name in Value data: text field

Important

The OEMID registry key is not restored automatically during Push Button Reset. Please refer to the next section of this guide to learn how to restore the OEMID registry key during PBR operation.

Prepare your image for Push Button Reset

This section provides guidance for setting up the recovery environment for Push Button Reset (PBR) scenarios.

Please reference Push-button reset and Windows Recovery Environment (Windows RE) and Hard Drives and Partitions for more information.

Push-button reset, is a built-in recovery tool which allows users to recover the OS while preserving their data and important customizations, without having to back-up their data in advance. It reduces the need for custom recovery applications by providing users with more recovery options and the ability to fix their own PCs with confidence.

Prepare ScanState

To start working with Push Button Reset, you'll need to copy ScanState to your USB drive.

Use scanstate to capture Classic Windows applications and settings on your image.

Note: You'll use your technician PC to prepare ScanState.

  1. On Technician PC Insert USBDrive

  2. Open Deployment and Imaging tools command prompt as administrator

  3. Run copydandi.cmd to copy necessary files to USBDrive\scanstate:

    Copydandi.cmd amd64 e:\scanstate
    

    Where E: is the letter of USBDrive.

Create a Scanstate migration file

In this section, you'll create a configuration file that will restore files and registry keys during Push-button reset.

Create a migration XML file used to restore registry values manually entered during manufacturing process. The sample below restores the OEMID registry value set earlier in this document.

  1. Open notepad

  2. Copy and paste the following xml into Notepad. This tells ScanState to migrate the OEMID registry key:

    <migration urlid="https://www.microsoft.com/migration/1.0/migxmlext/test">
         <component type="System" context="UserAndSystem">
              <displayName>OEMID</displayName>
            <role role="Settings">
                <rules>
                    <include>
                        <objectSet>
                            <pattern type="Registry">HKLM\Software\Microsoft\Windows\CurrentVersion\Store [OEMID]</pattern>
                        </objectSet>
                    </include>
                </rules>
            </role>
        </component>
    </migration>
    
  3. Save the file as regerecover.xml.

Create recovery package using Scanstate

Important

For Push Button Reset to work properly, packages have to be .ppkg files that are stored in C:\Recovery\Customizations.

On your reference PC:

Use ScanState to capture installed customizations into a provisioning package, and then save it to c:\Recovery\customizations.

  1. Create a Recovery folder at the root of the OS drive:

    mkdir C:\Recovery
    icacls C:\Recovery /inheritance:r
    icacls C:\Recovery /grant:r SYSTEM:(OI)(CI)(F)
    icacls C:\Recovery /grant:r *S-1-5-32-544:(OI)(CI)(F)
    takeown /f C:\Recovery /a
    attrib +H C:\Recovery
    
  2. Run ScanState to gather app and customizations:

    mkdir c:\recovery\customizations
    E:\ScanState\scanstate.exe /apps /ppkg C:\Recovery\Customizations\apps.ppkg /i:c:\recovery\oem\regrecover.xml /config:E:\scanstate\Config_AppsAndSettings.xml /o /c /v:13 /l:C:\ScanState.log
    

    Where E: is the drive letter of your USB drive.

  3. When ScanState completes successfully, delete scanstate.log and miglog.xml files:

    del c:\scanstate.log
    del c:\miglog.xml
    

Use Auto-apply folders to restore additional settings

Windows recovery will check C:\Recovery\AutoApply and automatically restore common settings including OOBE, Unattend, and Taskbar layout configurations that are included in that folder.

Make sure that copies of you unattend.xml, LayoutModification.json, TaskbarLayoutModification.xml, and OOBE folder are in C:\Recovery\AutoApply\ so that these files will automatically be applied during PBR.

Copy winre.wim backup

During the deployment winre.wim file is moved. Before capturing a final image, the backup winre.wim we created must be copied back, or the recovery environment will not work in the final image deployment.

Copy e:\images\winre_bak.wim c:\windows\system32\recovery\winre.wim

Reseal the image

In this section, we'll use sysprep.exe to reseal our image and get it ready for factory deployment.

  1. Delete installation folders and files that have been created of the preloaded applications. These folders can increase the size of a captured .wim file.
  2. If the SysPrep Tool is open, close it and open Command Prompt in Administrator mode.
  3. Generalize the image by using answer file with additional settings:
C:\Windows\System32\Sysprep\sysprep /oobe /generalize /unattend:c:\recovery\oem\Unattend.xml /shutdown

Finalize and Capture your image

We'll show you how to finalize and capture a factory image for mass deployment. To start this section, make sure your reference machine is shutdown after running sysprep in the previous section.

  1. Boot the Reference computer into WinPE.
  2. After WinPE has booted connect your USB drive.

Troubleshooting

  • If the reference PC boots from its internal HDD, Windows will enter the specialize and OOBE passes. You won't be able to capture a stable and generalized image if any of the configuration passes have completed. If either of those passes have completed, you'll need To generalize the image again. You can do with in Audit Mode (<Ctrl>+<Shift>+<F3> during OOBE). In Audit mode, run the Sysprep command from above. Make sure the PC boots to WinPE on the next restart.

  • If the system still boots to the internal HDD, check the PC's boot priority. Make sure that the USB has a higher boot priority than the internal hard drive.

  • Identify Windows Partition Drive letter using diskpart.

    1. At the X:\windows\system32> prompt, type diskpart and press the Enter key to start Diskpart.

    2. At the \DISKPART> prompt type list volume.

    3. Under the "Label" column, locate the volume that is labeled "Windows".

    4. Note what letter it is has been assigned under the "Ltr" column (Example: C). This is the USB key's drive letter.

    C:\WINDOWS\system32>diskpart
    
    Microsoft DiskPart version 10.0.22000.1
    
    Copyright (C) Microsoft Corporation.
    
    On computer: Windows
    
    DISKPART> list volume
    
    Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
    ----------  ---  -----------  -----  ----------  -------  ---------  --------
    Volume 0         System       NTFS   Partition    100 MB  Healthy    System
    Volume 1     C   Windows      NTFS   Partition    465 GB  Healthy    Boot
    Volume 2         Recovery     NTFS   Partition    500 MB  Healthy    Hidden
    Volume 3     D                       Removable         B  No Media
    
    5. Type exit to quit Diskpart.
    
    

(CompactOS Only) Convert installed customizations

This section shows how to reduce the size of ScanState packages.

Important

Only do this step if you are deploying to a device with limited storage. Single instancing impacts the launch performance of some desktop applications.

See Compact OS for more information.

To reduce the size of your ScanState recovery packages, run the following command from WinPE on your reference device:

DISM /Apply-CustomDataImage /CustomDataImage:C:\Recovery\Customizations\apps.ppkg /ImagePath:C:\ /SingleInstance

Capture your image

In this section, we'll tell you how to capture your sysprepped image. You can capture either a WIM or an FFU.

Capture a WIM

On your reference PC:

  1. Identify Windows Partition Drive letter.

    1. At the X:\windows\system32> prompt, type diskpart and press the Enter key to start Diskpart.

    2. At the \DISKPART> prompt type list volume

    3. Under the "Label" column, locate the volume that is labeled "Windows"

    4. Note what letter it is has been assigned under the "Ltr" column (Example: C). This is the drive letter that needs to be used

    5. Type exit to quit Diskpart

  2. Capture the image of the windows partition to your USB drive. This process takes several minutes.

    Note: We recommend using a cache directory when running DISM. In this step we'll create scratchdir on the USB drive key for temporary files, but you can choose any hard drive with available space for your scratch directory.

    MD e:\scratchdir
    Dism /Capture-Image /CaptureDir:C:\ /ImageFile:E:\Images\CustomImage.wim /Name:"CustomImage" /scratchdir:e:\scratchdir /EA
    

    This captures an image called CustomImage.wim to E:\Images. When the image capture is complete, you can shut down your reference PC.

With your image captured, you can skip to Verify your final image.

Capture an FFU

On your reference PC:

  1. Identify Windows Partition Drive letter.

    1. At the X:\windows\system32> prompt, type diskpart and press the Enter key to start Diskpart.

    2. At the \DISKPART> prompt type list disk

    3. Under the "Disk ###" column, identify the the disk that has the Windows installation, and note the assigned disk number. This will look something like Disk 0.

    4. Type exit to quit Diskpart

  2. Capture an image of the windows disk to your USB drive. This process takes several minutes.

    DISM.exe /capture-ffu /imagefile=E:\Images\CustomImage.wim /Name:"CustomImage" /capturedrive=\\.\PhysicalDrive0 /description:"Windows FFU"
    

    This captures an image called CustomImage.wim to E:\Images. When the image capture is complete, you can shut down your reference PC.

Verify your final image

In this section, we'll cover how to deploy your captured image for testing and verification.

Deploy your image to the reference device

  1. Boot the PC you want to test your image on into WinPE.

  2. Run applyimage.bat to deploy the image.

    If you captured a WIM called customimage.wim:

    E:\Deployment\applyimage.bat E:\Images\customimage.wim
    

    When the script asks you if your image uses extended attributes, answer Y because image you captured earlier specified the /EA option.

    or

    If you captured an FFU called CustomImage.FFU:

    E:\Deployment\applyimage.bat E:\Images\CustomImage.FFU
    
  3. Follow the script's prompts to apply the image.

  4. Type exit to close WinPE and restart the PC.

Validate the configuration

Your PC will restart and boot into Windows for the first time.

  1. In OOBE, create a dummy user which will be deleted later.

  2. Verify that any applications and offline customizations are still in your image and working properly.

    Some things to check are:

    • Taskbar
    • Pinned Apps
    • Desktop Wallpaper is set to display the right image
    • OEM Information displays correctly
    • OEM App ID registry key is set
    • Default Theme is the one you chose
    • Store apps start properly
    • Desktop applications start ok
    • Desktop applications applied via SPP start ok
    • If you enabled S mode, make sure the manufacturing registry key is removed

Verify Recovery

  1. Verify that your customizations are restored after recovery, and that they continue to function by running the Keep my files and Remove everything features from the following entry points:

    • Settings a. From the Start Menu, click Settings, b. In the Settings app, click Update & security, and then click Recovery. c. Click the Get Started button under Reset this PC and follow the on-screen instructions.

    • Windows RE a. From the Choose an option screen in Windows RE, click Troubleshoot b. Click Reset this PC and then follow the on-screen instructions

  2. Verify that recovery media can be created, and verify its functionality by running the bare metal recovery feature: a. Launch Create a recovery drive from Control Panel b. Follow the on-screen instructions to create the USB recovery drive c. Boot the PC from the USB recovery drive d. From the Choose an option screen, click Troubleshoot e. Click Recover from a drive and then follow the on-screen instructions

Optimize final image

At this point, you have a Windows image that is almost ready for deployment. In this section, we'll show you how to put the finishing touches on your image so you're ready for deployment.

  • Remove unused packages from your image, by exporting a copy of it.

    Dism /export-image /sourceimagefile:E:\images\customimage.wim /sourceindex:1 /destinationimagefile:e:\images\MasterImage_Pro.wim
    

Final shipment

You have to boot a PC at least once to allow the specialize configuration pass of Windows Setup to complete before shipping a PC.

The specialize configuration pass adds hardware-specific information to the PC and is complete when Windows OOBE appears.

Reference the OEM Policy Documentation for more details.

Reducing Disk Footprints

Throughout this guide, we have shown a few places where you can reduce the disk footprint:

  • Using Dism /export-image
  • Using Compact OS
  • Using Compact OS with Single Instancing

This section shows a few more ways you can gain additional free space.

Reducing and turning off Hiberfile

Reducing and turning off hiberfile can return between 400MB to 1.5GB OS space on the deployed OS.

Reducing Hiberfile by 30%

When you run sysprep.exe with unattend.xml, you can add a FirstLogonCommand that will reduce hiberfile:

<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="oobeSystem">
        <component name="Microsoft-Windows-Shell-Setup">
            <FirstLogonCommands>
                <SynchronousCommand wcm:action="add">
                    <CommandLine>powercfg /h /type reduced</CommandLine>
                    <Description>Reduce hiberfile size</Description>
                    <Order>1</Order>
                    <RequiresUserInput>false</RequiresUserInput>
                </SynchronousCommand>
            </FirstLogonCommands>
        </component>
    </settings>
</unattend>

Turn Off Hiberfile

When you run sysprep.exe with unattend.xml, you can add a FirstLogonCommand that will turn off hiberfile:

<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="oobeSystem">
        <component name="Microsoft-Windows-Shell-Setup">
            <FirstLogonCommands>
                <SynchronousCommand wcm:action="add">
                    <CommandLine>powercfg /h /type Off</CommandLine>
                    <Description>Reduce hiberfile size</Description>
                    <Order>1</Order>
                    <RequiresUserInput>false</RequiresUserInput>
                </SynchronousCommand>
            </FirstLogonCommands>
        </component>
    </settings>
</unattend>

Capture your image with the unattend.xml file that contains these settings.