Sample script: update an image

[This documentation is preliminary and is subject to change.]

Here's a detailed description of what's going on in the script: Walkthrough-UpdateImage-x64.bat. Modify this as a base to create your own images.

The script below runs through adding a language, language components, and boot-critical drivers (such as storage drivers or video drivers) to the Windows image and the built-in recovery tools. It's further explained in Appendix: Script used to update an image.

Image: Copying image files and deployment scripts

Prepare the images for offline servicing

Dn898430.wedge(en-us,VS.85).gifCopy the base Windows image file

  1. Click Start, and type deployment. Right-click Deployment and Imaging Tools Environment and then select Run as administrator.

  2. Create a copy of the image that you want to modify. For the purposes of this lab, use the base Windows 10 Technical Preview image file for either x64 or x86:

    md C:\Images\
    
    copy "C:\DFest\Win10 Home Tech Prev x64\sources\install.wim" C:\Images\WindowsWithFrench.wim
    

    This can take several minutes.

Dn898430.wedge(en-us,VS.85).gifMount the Windows image file

  • Mount the Windows image. The mounting process maps the contents of an image file to a location where you can view and modify the mounted image.

    md C:\mount\windows
    
    Dism /Mount-Image /ImageFile:"C:\Images\WindowsWithFrench.wim" /Index:1 /MountDir:"C:\mount\windows" /Optimize
    

    Where C is the drive letter of the drive that contains the image and Fabrikam is the name of the image.

    This step can take several minutes.

    Note  
    • The Dism /Mount-Image: /Optimize option allows you to begin working on the image files immediately. When you use the /Optimize option, the individual subfolders are added only as DISM needs them. When /Optimize is used, individual commands can take more time than usual.

    Troubleshooting: If the DISM commands in this section fail, try the following steps:

    If this command fails, make sure that you are using the Windows 10 Technical Preview version of DISM that is installed with the Windows ADK.

    If your technician PC uses Windows 8.1, Windows 8, or Windows 7, use the Deployment and Imaging Tools Environment to access the tools that are installed together with the Windows 10 Technical Preview version of the Windows ADK.

    Don’t mount images to protected folders, such as your User\Documents folder.

    If DISM processes are interrupted, consider temporarily disconnecting from the public network and disabling virus protection.

    If DISM processes are interrupted, consider running the commands from the Windows PE environment.

Dn898430.wedge(en-us,VS.85).gifMount the Windows RE image file

  • Mount the Windows RE image file. The Windows RE image file is part of the Windows image.

    md C:\mount\winre
    
    Dism /Mount-Image /ImageFile:"C:\mount\windows\Windows\System32\Recovery\winre.wim" /index:1 /MountDir:"C:\mount\winre"
    

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

    This step can take several minutes.

    Note  

    We recommend that you update the Windows and Windows RE images at the same time, to help make sure that any necessary files are included in both images.

Modify the images

Dn898430.wedge(en-us,VS.85).gifAdd languages to Windows

  1. Add languages, the basic language components, and any other language components to the Windows image. You'll need to install them in that order.

    Dism /Add-Package /Image:"C:\mount\windows" /PackagePath="C:\DFest\Samples\Languages\French fr-FR x64-client.cab" /LogPath=dism.fod2.log
    Dism /Add-Package /Image:"C:\mount\windows" /PackagePath="C:\DFest\Samples\Language components x64\Microsoft-Windows-LanguageFeatures-Basic-fr-fr-Package.cab" /LogPath=dism.fod2.log
    Dism /Add-Package /Image:"C:\mount\windows" /PackagePath="C:\DFest\Samples\Language components x64\Microsoft-Windows-LanguageFeatures-Handwriting-fr-fr-Package.cab" /LogPath=dism.fod2.log
    

    where C is the drive letter of the drive.

  2. Verify that the language package is part of the image:

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

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

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

    Package Identity : Microsoft-Windows-Client-LanguagePack  ...  fr-FR~10.0.9926.0
    State : Installed
    
    
  3. Verify that the language component is part of the image:

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

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

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

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

Dn898430.wedge(en-us,VS.85).gifAdd languages to Windows RE

  • Skip this step, it's not supported for this lab. when you add languages to Windows, you'll add them to Windows RE. However, it's not supported for this lab.

    Typically, you'd add the same set of languages to the Windows RE image that you add to the Windows image to ensure a consistent language experience in recovery scenarios.

    Note, Windows RE now requires the WinPE-HTA package, this is new for Windows 10 Technical Preview.

    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\fr-fr\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\fr-fr\WinPE-Rejuv_fr-fr.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\fr-fr\WinPE-EnhancedStorage_fr-fr.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\fr-fr\WinPE-Scripting_fr-fr.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\fr-fr\WinPE-SecureStartup_fr-fr.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\fr-fr\WinPE-SRT_fr-fr.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\fr-fr\WinPE-WDS-Tools_fr-fr.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\fr-fr\WinPE-WMI_fr-fr.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\fr-fr\WinPE-StorageWMI_fr-fr.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\fr-fr\WinPE-HTA_fr-fr.cab"
    

Unmount the images

Dn898430.wedge(en-us,VS.85).gifInstructions

  1. Close all applications that might access files from the image.

  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:

    xcopy C:\mount\windows\Windows\System32\Recovery\winre.wim C:\Images\WinREWithFrench.wim /ah
    

    When prompted, specify F for file.

  4. Check the new size of the Windows RE image.

    Dir "C:\mount\windows\Windows\System32\Recovery\winre.wim"
    

    If the size of the partition is greater than 524,288,000 bytes, convert the file size into megabytes and modify the deployment script: CreatePartitions-<Firmware>.txt with the new value. To learn more, see UEFI/GPT-based hard drive partitions. Example:

    rem == 3. Windows RE tools partition ===============
    create partition primary size=600
    
  5. 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.

 

 

Show: