Export (0) Print
Expand All

Deploy WIMBoot Images: If you know the size of the images upfront

Updated: April 2, 2014

Applies To: Windows 8.1

Deploy Windows image file boot (WIMBoot) on new PCs using the images you created in Create WIMBoot Images.

WIMBoot helps you save hard drive space by booting to a WIM file rather than a set of uncompressed Windows files.

To deploy Windows, you'll need to configure the hard drive partitions with the Images partition at the end of the drive, containing the Windows image file, the Windows RE image file, and if included, an image file for final customizations (custom.wim).

The following diagram shows this configuration.

Partitions map: System, MSR, Windows, Images

The final customizations in the custom.wim file may include Windows updates, build-to-order apps and drivers, or other changes that typically happen on the factory floor. This means you don't have to recapture these updates into the fully-loaded install.wim. This change can potentially save time during the manufacturing process.

If this size of your custom.wim file varies widely, you may need to use a script to calculate the size of the Images partition. For more info, see Deploy WIMBoot Images: If you don't know the size of the images upfront.

noteNote
Do not preload traditional system recovery tools, because they won’t be able to restore a PC with the WIMBoot configuration. Instead, use the built-in push-button reset tools, which you can configure automatically by using the procedures on this page.

  1. Prepare a WIMBoot image (install_wimboot.wim) and separate out the Windows RE image (winre.wim). For more info, see Create WIMBoot Images.

  2. Create a Windows PE 5.1 bootable drive by adding the Windows 8.1 Update packages to Windows PE 5.0, and then cleaning up the image. For more info, see Update WinPE 5.0 to WinPE 5.1.

  1. Boot the reference PC into Windows PE 5.1.

  2. Format the drive using the following partition layout:

    • System (EFI System Partition): Size: 100MB.

      If the primary drive is less than 16GB, you can use a minimum size of 32MB.

      If the primary drive is an Advanced Format 4K Native drive (4-KB-per-sector), the minimum size is 260 MB.

    • MSR (x86 and x64 only, not needed for ARM)

    • Windows.

    • Images. Set this partition with the following attributes:

      • Location: End of the disk

      • Type: de94bba4-06d1-4d40-a16a-bfd50179d6ac (PARTITION_MSFT_RECOVERY_GUID)

      • Attributes: 0x8000000000000001 (GPT_BASIC_DATA_ATTRIBUTE_NO_DRIVE_LETTER & GPT_ATTRIBUTE_PLATFORM_REQUIRED)

      • File system: NTFS

      • Drive Letter: Set a temporary drive letter, for example, M.

      • Size: Must be big enough to hold install.wim, winre.wim, and custom.wim files plus at least 50 MB of free space.

        noteNote
        If you plan to make changes on the factory floor in the custom.wim file, be sure to leave enough space for these additions. But try not to add too much free space, especially on devices with limited drive space, because this partition can’t be resized after you've added files to it.

        To work around this problem, you can set up this Images partition later. For more info, see Deploy WIMBoot Images: If you don't know the size of the images upfront.

Sample Diskpart script

The script temporarily assigns these drive letters: Windows=C and Images=M. If you’re deploying to PCs with unformatted hard drives, you might want to modify this script to use a drive letter that’s near the end of the alphabet, such as W, to avoid drive letter conflicts. Do not use X, because this drive letter is reserved for Windows PE. After the PC reboots, the Windows partition is assigned the letter C, and the other partitions don’t receive drive letters. We've added volume names to the partitions, but they aren’t required.

rem == Diskpart /s CreatePartitions-WIMBoot.txt ==
rem == These commands set up the hard drive partitions
rem    for WIMBoot. 
rem
rem    Adjust the partition sizes to fill the drive
rem    as necessary. ==
select disk 0
clean
convert gpt
rem == 1. System partition (ESP) ===================
create partition efi size=100
format quick fs=fat32 label="System"
rem == 2. Microsoft Reserved (MSR) partition =======
create partition msr size=128
rem == 3. Windows partition ========================
create partition primary
shrink minimum=10000
format quick fs=ntfs label="Windows"
assign letter=c
rem === 4. Images partition ========================
create partition primary
format quick fs=ntfs label="Images"
assign letter=m
set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
gpt attributes=0x8000000000000001
list volume
exit

  1. Create a folder called "Windows Images" on the Images partition. This folder name is required.

    md "M:\Windows Images\"
    
  2. Copy the Windows image from the USB or network drive (N) to the Windows Images folder.

    Rename the image file install.wim (if necessary). This filename is required.

    copy N:\Images\install_update1.wim "M:\Windows Images\install.wim"
    
  3. Apply the Windows image to the Windows partition (drive C), using the /WIMBoot option.

    Recommended: create a temporary scratch folder for DISM to avoid issues related to short file names. To prevent capturing the DISM logs in your image, choose a location that is in your DISM Exclusion list. For more info, see DISM Configuration List and WimScript.ini Files.

    When you use the DISM /Apply-Image command with the /WIMBoot option, the ImageFile location and ApplyDir partition must be on the same hard drive.

    md C:\Recycler\Scratch
    
    DISM /Apply-Image /ImageFile:"M:\Windows Images\install.wim" /ApplyDir:C: /Index:1 /WIMBoot /ScratchDir:C:\Recycler\Scratch
    
    noteNote
    When you apply the Windows image using /WIMBoot, DISM adds pointer files from the Windows partition to the Images partition. These pointer files make the PC appear and function as if the Windows files were stored on the Windows partition. But they still primarily reside inside the install.wim file in the Images partition. Do not remove the install.wim file after applying the image.

  4. Create boot files and set them to boot to the Windows partition.

    C:\Windows\System32\bcdboot C:\Windows
    
  5. Copy the Windows RE file to the Images folder. Note that Winre.wim may be a hidden file. Use robocopy or xcopy to copy the file. In this example, the "echo f" command suppresses the xcopy "File or Directory" prompt:

    md M:\Recovery\WindowsRE
    
    echo f | xcopy N:\Images\winre.wim M:\Recovery\WindowsRE\winre.wim /h
    
  6. Register the Windows RE partition.

    C:\Windows\System32\Reagentc /SetREImage /Path M:\Recovery\WindowsRE /Target C:\Windows
    
  7. If your partition configuration is different from the recommended configuration listed above, create a ResetConfig.xml file and include it in the M:\Windows Images\ folder to enable your users create bare metal recovery media. For more info, see ResetConfig XML Reference.

Sample command-line script

@echo off
echo == ApplyWIMBootImage.cmd ==

echo == These commands deploy a specified Windows
echo    image file to the Windows partition, and configure
echo    the system partition.

rem    Usage:   ApplyWIMBootImage InstallWim WinREWim 
rem    Example: ApplyWIMBootImage N:\Images\Install-WIMBoot.wim N:\Images\WinRE-WIMBoot.wim

if "%2" equ "" (
echo == Error: Specify a Windows image and a Windows RE image file.
echo    Example: ApplyWIMBootImage N:\Images\Install-WIMBoot.wim N:\Images\WinRE-WIMBoot.wim
exit /b 0
)
@echo on

rem == Add the Windows image to the Images partition ==
md "M:\Windows Images\"
copy %1 "M:\Windows Images\install.wim"

rem == Create a scratch directory for DISM operations
md "C:\Recycler\Scratch"

rem == Apply the Windows image to the Windows partition ==
dism /Apply-Image /ImageFile:"M:\Windows Images\install.wim" /ApplyDir:C: /Index:1 /WIMBoot /ScratchDir:C:\Recycler\Scratch

rem == Create boot files on the System partition ==
C:\Windows\System32\bcdboot C:\Windows

:rem == Add the Windows RE image to the Images partition ==
md M:\Recovery\WindowsRE
copy %2 M:\Recovery\WindowsRE\winre.wim

:rem == Register the location of the recovery tools ==
C:\Windows\System32\Reagentc /SetREImage /Path M:\Recovery\WindowsRE /Target C:\Windows

  1. Reboot the PC and log in as a user.

  2. Install and run performance test software in the Windows environment.

  1. Reboot the PC into Windows PE 5.1.

  2. Temporarily assign drive letters to the Windows and Images partitions.

    Diskpart /s ResetWIMBootDriveLetters.txt
    
    rem == Diskpart /s ResetWIMBootDriveLetters.txt ==
    select disk 0
    select partition 1
    assign letter s
    select partition 3
    assign letter c
    select partition 4
    assign letter m
    list volume
    exit
    
  3. Reapply the Windows image to the Windows partition. Recommended: create a temporary scratch directory for DISM.

    rem == ResetWIMBootImage.cmd ==
    
    format C: /Q /FS:NTFS /v:"Windows"
    
    md C:\Recycler\Scratch
    
    DISM /Apply-Image /ImageFile:"M:\Windows Images\install.wim" /ApplyDir:C: /Index:1 /WIMBoot /ScratchDir:C:\Recycler\Scratch
    

  1. Press CTRL+SHIFT+F3 at the OOBE screens to enter audit mode.

  2. Add final customizations, such as build-to-order apps, drivers, or Windows updates.

  3. Prepare the PC to boot into OOBE mode, and shut down the PC.

    Recommended: Generalize the image to optimize the push-button reset features. If you do this, we recommend that you boot the PC once after the Images partition is created in order to speed up the OOBE process. For more info, see Perform final reboot.

    C:\Windows\System32\Sysprep\Sysprep /OOBE /shutdown /generalize
    
  4. Reboot the PC into Windows PE 5.1.

  5. Check to make sure you have enough room on the Images partition to capture the changes. If you've made it this far and there's not room, you might have to go back to the beginning of this page.

  6. Capture factory floor customizations into custom.wim.

    DISM /Capture-CustomImage /CaptureDir:C: /ScratchDir:C:\Recycler\Scratch
    
    noteNote
    When you capture the custom image, DISM captures the incremental file changes (based on the specific install.wim file) to a new file, custom.wim, and converts these files to pointer files. The custom.wim is placed in the same folder as install.wim.

    • Don’t copy custom.wim to other PCs. Custom.wim is not intended as a replacement for modifying the primary install.wim file.

    • Don’t switch out the install.wim file after creating custom.wim.

    • Don't remove or re-capture custom.wim after capturing the incremental file changes. If you do need to modify the factory floor customizations, restart the process from the beginning of this page, including reformatting the entire drive.

  7. Remove the scratch folder.

    rd C:\Recycler /s /q
    

  • Protect the Windows images partitions by setting them as read-only. Run these steps from an elevated command prompt:

    icacls "M:\Windows Images" /inheritance:r /T
    
    icacls "M:\Windows Images" /grant:r SYSTEM:(R) /T
    
    icacls "M:\Windows Images" /grant:r *S-1-5-32-544:(R) /T
    
    noteNote
    It’s not necessary to hide the WIMBoot partitions.

  • Recommended: If you generalized the image when performing the factory floor customizations, allow the PC to boot up once to Windows in order to speed up the first boot experience for the end user. After the PC reaches the OOBE screen, you can safely turn off the PC without shutting it down.

  1. Boot to Windows PE.

  2. Temporarily assign drive letters to the Windows and Images partitions, and verify that the System, MSR, Windows, and Images partitions exist and are in the prescribed order.

    Diskpart /s VerifyWIMBootPartitions.txt
    
    Rem = Diskpart /s VerifyWIMBootPartitions.txt
    select disk 0
    select partition 3
    assign letter C
    select partition 4
    assign letter M
    list partition
    exit
    

    Expected output:

      Partition ###  Type              Size     Offset
      -------------  ----------------  -------  -------
      Partition 1    System             100 MB  1024 KB
      Partition 2    Reserved           128 MB   101 MB
      Partition 3    Primary         (size) GB   229 MB
      Partition 4    Recovery        (size) GB (size) GB
    
  3. Verify that the Images partition has these attributes:

    • Type: de94bba4-06d1-4d40-a16a-bfd50179d6ac (PARTITION_MSFT_RECOVERY_GUID)

    • Attributes: 0x8000000000000001 (GPT_BASIC_DATA_ATTRIBUTE_NO_DRIVE_LETTER & GPT_ATTRIBUTE_PLATFORM_REQUIRED)

    • File system: NTFS

    diskpart
      select disk 0
      select partition 4
      detail partition
    exit
    

    Expected output:

    Partition 4
    Type    : de94bba4-06d1-4d40-a16a-bfd50179d6ac
    Hidden  : Yes
    Required: Yes
    Attrib  : 0X8000000000000001
    Offset in Bytes: 48474619904
    
      Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
      ----------  ---  -----------  -----  ----------  -------  ---------  --------
    * Volume 2     M   Images       NTFS   Partition     74 GB  Healthy    Hidden
    
  4. Verify that these WIM files are in the Images partition:

    • \Windows Images\install.wim

    • \Windows Images\custom.wim (if factory floor customizations were added)

    • \Recovery\WindowsRE\winre.wim

    dir "M:\Windows Images"
    
    dir M:\Recovery\WindowsRE
    

    Expected output:

    M:\>dir "M:\Windows Images"
    Volume in drive M is Images
     Volume Serial Number is 8AA9-5E31
    
     Directory of M:\Windows Images
    
    12/19/2013  04:16 PM    <DIR>          .
    12/19/2013  04:16 PM    <DIR>          ..
    12/18/2013  02:53 PM     3,541,267,886 install.wim
    12/18/2013  03:00 PM         1,000,000 custom.wim
                   1 File(s)  3,542,267,886 bytes
                   2 Dir(s)      52,428,800 bytes free
    
    M:\>dir M:\Recovery\WindowsRE
     Volume in drive M is Images
     Volume Serial Number is 8AA9-5E31
    
     Directory of M:\Recovery\WindowsRE
    
    12/19/2013  04:21 PM    <DIR>          .
    12/19/2013  04:21 PM    <DIR>          ..
    12/14/2013  07:28 AM       228,955,033 winre.wim
                   1 File(s)    228,955,033 bytes
                   2 Dir(s)      52,428,800 bytes free
    
  5. Verify that the Windows Images subfolder has read-only access.

    icacls "M:\Windows Images"
    

    Expected output:

    M:\Windows Images BUILTIN\Administrators:(R)
                      NT AUTHORITY\SYSTEM:(R)
    
  6. Verify that Windows RE is correctly set to a valid recovery image location.

    C:\Windows\System32\Reagentc /Info /Target C:\Windows
    

    Expected output:

    Windows RE status: <either Enabled or Disabled>
    Windows RE location: 
    Boot Configuration Data (BCD) identifier: 00000000-0000-0000-0000-000000000000
    Custom boot key scan code: 0x0
    Recovery image location: \\?\GLOBALROOT\device\harddisk0\partition4\RecoveryImage
    Recovery image index: 1
    Custom image location:
    Custom image index: 0
    
  7. Reset the PC using the push-button reset tools.

    If the push-button recovery process fails, make sure that you've updated both the Windows and the Windows RE images to include the Windows 8.1 Update. For more info, see Install the Windows 8.1 Update for OEMs.

See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft