Share via


Create an OS Image on a USB Flash Drive (Standard 8)

7/8/2014

Learn how to create a Windows Embedded 8 Standard (Standard 8) image from a configuration file and apply that image to a bootable USB flash drive.

Introduction

In this lab exercise you will create an OS image on a reference device by using a configuration file you created in Image Configuration Editor (ICE) and then use Image Builder Wizard (IBW), Windows Preinstallation Environment (Windows PE) 4.0, Sysprep, BootBCD, PowerShell, DiskPart, and ImageX to capture and apply the OS image on a Windows To Go bootable USB flash drive.

Lab Exercise Purpose

This lab demonstrates how to create and apply an OS image on a Windows To Go bootable USB flash drive.

Overview of Steps

In this lab, you will create an OS image on a reference device by using the configuration file that you created in Create a Configuration File by Using Image Configuration Editor. Next, you will capture the OS image from the reference device and apply the OS image on a Windows To Go bootable USB flash drive.

  • Step 3: Prepare an Installed Reference Device OS for Imaging
    Use Sysprep to generalize the reference device and prepare for imaging.
  • Step 4: Capture an OS Image WIM File
    Use Windows PE 4.0 and ImageX to capture the reference device OS image.
  • Step 5: Prepare a Bootable USB Flash Drive
    Use PowerShell commandlets or DiskPart to prepare a Windows To Go bootable USB flash drive.
  • Step 6: Apply an OS Image WIM File to a Bootable USB Flash Drive
    Use ImageX to apply the OS image to a Windows To Go bootable USB flash drive.

Prerequisites

To perform the steps in this lab exercise, the following are required:

Required Hardware

Your development computer and your device must meet the minimum hardware requirements:

In addition, you must use a Windows To Go certified USB flash drive as the target drive to install the captured OS reference image.

You can find out more about Windows To Go certified USB flash drives in the TechNet topic Windows To Go: Feature Overview.

You will also need a general purpose USB flash drive to use as a Windows PE 4.0 bootable utility USB flash drive.

Required Software

The following software is required:

Required Lab Exercises or Knowledge

The following work items must be completed before you begin this lab exercise:

  1. Get Started with Standard 8
  2. Create a Configuration File by Using Image Configuration Editor
  3. Automatically create a bootable utility USB drive containing a Windows PE Image

You will also need the deployment tools for your reference device target architecture.

Copy the BCDBoot and DISM folders from one of the following locations on your development computer to the bootable utility USB flash drive:

  • %PROGRAMFILES%\Windows Embedded 8 Standard\Toolset\Windows Deployment Tools\Deployment Tools\x86
  • %PROGRAMFILES%\Windows Embedded 8 Standard\Toolset\Windows Deployment Tools\Deployment Tools\amd64

Knowledge of the following is recommended before you begin this lab exercise:

For information about scenarios and risks that you should consider when you design devices that run on USB flash drives, see Working with USB Boot on MSDN.

Step 1: Start IBW on a Reference Device

In this step you will start up your device and start Image Builder Wizard (IBW).

To start IBW on a reference device

  1. To start IBW on your device, do one of the following:

    • Run setup.exe from the Standard 8 IBW DVD. Use the version of the DVD (x86 or x64) that matches the architecture of your device, not your development computer.

    • If your device cannot boot from a DVD, startup your device by using the USB flash drive that you prepared in Step 2: (Optional) Create USB Boot Media for Your Device in the Get Started with Standard 8 lab exercise.

      Tip

      To startup from a USB flash drive, you may need to adjust the BIOS settings on your device.

Step 2: Deploy an OS Image on a Reference Device by Using a Configuration File

In this step you will use IBW to deploy an OS on your device by using a configuration file.

To deploy an OS on a reference device

  1. In IBW, in Windows Setup, click Deploy a Configuration File or WIM.

  2. Browse to the location where you saved your configuration file in Step 6: To add dependencies and validate and save your configuration file of the Create a Configuration File by Using Image Configuration Editor lab exercise.

  3. Select **LabBaseConfig.xml ** and click Open. The setup process starts.

  4. Select I accept the license terms, and then click Next.

  5. Select your language preferences, and then click Next.

  6. In Windows Setup, on the Where do you want to install Windows page, select the drive and partition that your device is configured to start from.

    Warning

    The following steps will format the selected drive. Before proceeding, make sure that there is no data on the partition that you need to keep.

  7. Click Drive Options (advanced), and then click Format.

  8. Click OK to begin formatting the partition.

  9. After the partition is formatted, click Next to install your OS image on the device. During the installation process (which will take several minutes), your device will restart. You must remove the USB flash drive before your device restarts to complete the installation process.

    If you forget to remove the USB flash drive, your device may start back into the IBW tool. If that occurs, exit IBW and remove the USB flash drive and restart the device.

  10. When the Install evaluation copy screen appears, click Next, and complete the Standard 8 setup wizard to configure your OS.

  11. Configure your reference device with any settings or applications that you want installed on the OS image.

Step 3: Prepare an Installed Reference Device OS for Imaging

In this step you will prepare your reference device OS for imaging by using the sysprep command-line tool and Windows PE 4.0.

To prepare a reference device OS for imaging

  1. Open an administrator command prompt.

  2. At the command prompt, type the following:

    sysprep /generalize /oobe /shutdown
    

    The /generalize option will prepare the OS for imaging. The /oobe option will set the OS to start in Windows Welcome mode on the next restart. The /shutdown option will shut down the device when sysprep has finished.

  3. Restart the reference device from the bootable utility USB flash drive that contains Windows Preinstallation Environment (Windows PE) 4.0.

  4. At the command prompt, locate the reference OS image by checking each drive letter using the dir command, starting with drive C:, and then drive D:, drive E:, and so on.

    For example:

    dir c:\
    dir d:\
    dir e:\
    

    Repeat this process through all available drive letters until you identify the reference device OS installation.

  5. At the command prompt, type the following:

    reg load hklm\temp <generalized os drive>:\windows\system32\config\system
    

    Where <generalized os drive> is drive letter where you located the reference device OS installation. For example:

    reg load hklm\temp d:\windows\system32\config\system
    
  6. At the command prompt, type the following:

    reg delete hklm\temp\mounteddevices
    

    At the command prompt, type the following:

    reg unload hklm\temp
    
  7. Verify that the bootmgr and boot\bcd files are present on the generalized OS drive. If the files are not present, at the command prompt, move into the location of the BCDBoot.exe tool on the bootable utility USB flash drive that contains Windows Preinstallation Environment (Windows PE) 4.0 and type the following:

    bcdboot <generalized os drive>:\windows /s <generalized os drive>:
    

    Where <generalized os drive> is the drive letter where you located the reference device OS installation. For example:

    bcdboot d:\windows /s d:
    

For more information about how to use sysprep, see Sysprep Command-Line Settings.

For more information about how to use BCDBoot, see BCDBoot Technical Reference.

Step 4: Capture an OS Image WIM File

In this step you will capture your prepared reference device OS image to a .wim file.

To capture an OS image WIM file

  1. Attach the bootable utility USB flash drive that contains Windows PE 4.0 to your reference device and start the reference device from Windows PE 4.0.

  2. At the Windows PE 4.0 command prompt, move to the folder on the bootable utility USB flash drive that contains the ImageX command-line tool. For example:

    cd x86/DISM
    
  3. At the Windows PE 4.0 command prompt, type the following:

    imagex /capture <generalized os drive>: <utility drive>:\referenceimage.wim "ReferenceImage" /check /verify
    

    Where <generalized os drive> is the drive letter of the reference device OS installation and <utility drive> is the drive letter of the bootable utility USB flash drive. For example:

    imagex /capture d: x:\referenceimage.wim "ReferenceImage" /check /verify
    
  4. When ImageX is finished capturing the reference OS image .wim file, it will display a message. For example:

    Successfully imaged d:\
    Total elapsed time: 18 min 42 sec
    

    You can now shutdown your reference device and remove the bootable utility USB flash drive that contains the reference OS image .wim file.

For more information about how to use the ImageX command-line tool, see ImageX Technical Reference.

Step 5: Prepare a Windows To Go USB Flash Drive

In this step, you will prepare a Windows To Go USB flash drive. There are two different options you can choose from.

To make your Windows To Go USB flash drive bootable by using PowerShell

  1. Attach your Windows to Go USB flash drive to your development computer.

  2. Prepare your Windows to Go USB flash drive by using the PowerShell commandlets as shown in the “To create a Windows To Go workspace with PowerShell commands” procedure in the TechNet Wiki article Windows To Go Step by Step.

    For reference, the PowerShell commandlets from the TechNet Wiki article are shown here:

    # The following command will set $Disk to all USB drives with >20 GB of storage
    
    $Disk = Get-Disk | Where-Object {$_.Path -match "USBSTOR" -and $_.Size -gt 20Gb -and -not $_.IsBoot}
    
    # Clear the disk. This will delete any data on the disk and will fail if the disk is not yet initialized.
    # If that happens, simply continue with ‘New-Partition…)
    # Validate that this is the correct disk that you want to completely erase.
    # To skip the confirmation prompt, append –confirm:$False
    
    Clear-Disk –InputObject $Disk[0] -RemoveData 
    
    # This command initializes a new MBR disk
    
    Initialize-Disk –InputObject $Disk[0] -PartitionStyle MBR
    
    # This command creates a 350 MB system partition
    
    $SystemPartition = New-Partition –InputObject $Disk[0] -Size (350MB) -IsActive 
    
    # This formats the volume with a FAT32 Filesystem
    # To skip the confirmation dialog, append –Confirm:$False
    
    Format-Volume -NewFileSystemLabel "UFD-System" -FileSystem FAT32 -Partition $SystemPartition
    
    # This command creates the Windows volume using the maximum space available on the drive. The Windows To Go drive should not be used for other file storage.
    
    $OSPartition = New-Partition –InputObject $Disk[0] -UseMaximumSize
    Format-Volume -NewFileSystemLabel "UFD-Windows" -FileSystem NTFS -Partition $OSPartition
    
    # This command assigns drive letters to the new drive, the drive letters chosen should not already be in use.
    
    Set-Partition -InputObject $SystemPartition -NewDriveLetter "S"
    Set-Partition -InputObject $OSPartition -NewDriveLetter "W"
    
    # This command toggles the NODEFAULTDRIVELETTER flag on the partition which prevents drive letters being assigned to either partition when inserted into a different machine.
    
    Set-Partition -InputObject $OSPartition -NoDefaultDriveLetter $TRUE
    

When you have finished preparing your Windows To Go USB flash drive, continue with Step 6: Apply an OS Image WIM File to a Bootable USB Flash Drive.

To make the USB media bootable by using DiskPart

  1. Attach your Windows To Go USB flash drive to your development computer.

  2. On the development computer, open an administrator command prompt.

  3. At the command prompt, run the DiskPart tool by typing the following :

    diskpart
    
  4. Use the DiskPart tool to determine the disk number that will be used for the next step by typing the following at the command prompt:

    list disk
    

    Identify the USB flash drive by looking at the Size column to see which disk matches the size of the USB flash drive.

  5. Use the DiskPart tool to partition and format the device and make it bootable. For example, if the USB flash drive is Disk 1, type the following at the DiskPart command prompt:

    select disk <disk_number>
    clean
    create partition primary 
    select partition 1
    active
    format fs=ntfs quick
    assign
    exit
    

    Important

    You must format the USB drive using the NTFS file system because some of the files that will be copied to the USB flash drive may be larger than the FAT file system can handle. Be sure to type these commands carefully to avoid formatting the wrong drive.

  6. Now that the USB flash drive is formatted and bootable, go to Step 6: Apply an OS Image WIM File to a Bootable USB Flash Drive.

For more information about how to use DiskPart, see DiskPart Technical Reference

Step 6: Apply an OS Image .wim File to a Windows To Go Bootable USB Flash Drive

In this step, you will apply the captured OS image .wim file to a Windows To Go Bootable USB Flash Drive.

To apply an OS image .wim file to a Windows To Go bootable USB flash drive

  1. Attach the prepared Windows To Go bootable USB flash drive and the Windows PE 4.0 bootable utility USB flash drive that contains the captured OS image WIM file to your development computer.

  2. On the development computer, open an administrator command prompt.

  3. At the command prompt, move to the location of ImageX that matches the architecture of your reference device OS image. For example:

    cd C:\Program Files (x86)\Windows Embedded 8 Standard\Toolset\Windows Deployment Tools\Deployment Tools\x86\DISM
    
  4. At the command prompt, type the following:

    imagex /apply <utility drive>:\referenceimage.wim 1 <target drive>: /verify
    

    Where <utility drive> is the drive letter of the bootable utility USB flash drive that contains the captured OS image .wim file and <target drive> is the drive letter of the Windows To Go bootable USB flash drive. For example:

    imagex /apply f:\referenceimage.wim 1 g: /verify
    
  5. When ImageX is applying the reference OS image .wim file to the target Windows To Go bootable USB flash drive, it will display a message. For example:

    [  10% ] Applying (with verification) progress: 19:35 mins remaining
    

    When ImageX is finished applying the .WIM file, you can detach the Windows To Go USB flash drive from your development computer.

    You can now start a device by using the OS image on the Windows To Go USB flash drive.

For more information about how to use the ImageX command-line tool, see ImageX Technical Reference.

Conclusion

In this lab exercise, you created an OS image on a bootable USB flash drive by using the configuration file that you created in Create a Configuration File by Using Image Configuration Editor and by using IBW, Windows PE 4.0, Sysprep, BootBCD, DiskPart, and ImageX.

The following lab exercises include related information:

Create a Configuration File by Using Image Configuration Editor

See Also

Other Resources

Lab Exercises
Image Builder Wizard Technical Reference