Create a custom boot image
From Science IT
An operating system deployment boot image is a Windows PE image and is used during an operating system deployment. By default, Configuration Manager 2007 creates an x86 and x64 boot image for use with operating system deployments. The boot images are displayed in the results pane when you select the Boot Images node in the Configuration Manager 2007 administrator console.
You can also import you own custom boot images. You may want custom boot images for any of the following scenarios:
- You want to run scripts or custom actions in Windows PE that require optional Windows PE components that are not enabled in the default Configuration Manager 2007 boot images.
- You would like to include custom tools and scripts in the Windows PE image.
- You would like to initiate operating system deployments using boot media, stand-alone media and PXE initiated deployments.
- If you are deploying operating systems in a complex environment you may require multiple boot images containing different sets of device drivers. Adding device drivers to a boot image increases the size of the boot image so individual boot images should not contain all available device drivers.
To successfully import a custom boot image, the boot image must already be finalized or the SMS Provider will reject it. Configuration Manager 2007 setup puts two finalized boot images in the following directory: <SMS installation>\OSD\boot\<arch>. You can import these boot images into the boot image catalog. Use the following procedure to create a new source boot image that can be imported:
With WinPE 2.0 / WAIK 1.1
NOTE: These steps must be run on a computer running the SMS Provider with WAIK v1.1 (e.g. SIT-SCCM-01 would be a good choice).
- Copy a boot image from the directory where the Windows Automated Installation Kit (WAIK) is installed. E.G. for an x86 boot image
<WAIK_FOLDER>\Tools\PETools\copype.cmd x86 d:\temp\pe
- Mount this new copied boot image to a temporary directory. For example:
imagex.exe /mountrw d:\temp\pe\winpe.wim 1 d:\temp\pe\mount
- Install the three required components that are required to perform Configuration Manager 2007 operating system deployments:
peimg.exe /install=WinPE-Scripting-Package d:\temp\pe\mount\windows peimg.exe /install=WinPE-WMI-Package d:\temp\pe\mount\windows peimg.exe /install=WinPE-XML-Package d:\temp\pe\mount\windows
- Optionally install other useful package components
peimg.exe /install=*HTA* d:\temp\pe\mount\windows (Hypertext Application support - required if using MDT Unknown Computer hook) peimg.exe /install=*MDAC* d:\temp\pe\mount\windows (DB Connectivity - required if using MDT Database) peimg.exe /install=*Fonts* d:\temp\pe\mount\windows (Asian language support)
- Optionally copy any tools you want available
copy c:\program files\ConfigMgr 2007 Toolkit\CCM Tools\Trace32.exe d:\temp\pe\mount\windows\system32\ (tool for viewing log files) copy d:\tools\*.* d:\temp\pe\mount\windows\system32\ (misc tools)
- Optionally save a copy of the custom Boot Image (after dismounting the WIM)
xcopy d:\temp\pe\winpe.wim d:\temp\pe\winpe.sccm.wim (makes like simpler next time)
- Finalize the boot image using the following command:
peimg.exe /prep d:\temp\pe\mount /f
- Dismount the boot image using the following command:
imagex.exe /unmount /commit d:\temp\pe\mount
- Export the custom boot image. This step is necessary to reduce the image footprint:
imagex.exe /export d:\temp\pe\winpe.wim 1 d:\temp\pe\sccm-boot.wim
NOTE: imagex.exe and peimg.exe are located in the WAIK installation directory - use the "Win PE Tools Command Prompt" ;)
If you have integrated the MDT with SCCM then you can use the "Create boot image using Microsoft Deployment" wizard found under "Operating System Deployment > Boot Images > Add Boot Image" which does most of the above for you.
With WinPE 3.0 / WAIK For Windows 7
This will describe the process required to create a customised Windows PE3 Image which can then be used to create a bootable CD-ROM, USB Flash Drive or installed to a hard disk.
The WinPE FoS-Boot Images are available at : \\sit-build.fos.auckland.ac.nz\public\FoS-Boot\
This contains a customised WinPE3 Boot Environment with the tools for the Science IT staff. You can burn the ISO directly to DVD (a CD is too small) or see the instructions below for creating a USB Flash Drive version.
- A technician computer with the Windows Automated Installation Kit / DISM.
- Your custom applications.
Step 1: Set up a WinPE build environment
In this step, you create a directory structure that supports building a Windows PE image. This directory structure is required. To start, run the Deployment Tools Command Prompt from the Windows AIK as an administrator (right click and select "Run as Administrator").
At the command prompt run the copype.cmd script to create your PE environment.
copype.cmd <architecture> <destination>
Where <architecture> can be x86, amd64 or ia64 and <destination> is the directory you wish to create your build environment inside. For example
copype.cmd x86 d:\winpe\x86
This will create the base directory structure necessary and copy a basic WIM file for your architecture. For example
d:\winpe\x86\winpe.wim d:\winpe\x86\iso\ d:\winpe\x86\mount\
Copy the base WIM file into the \winpe\x86\iso\sources folder and rename it to boot.wim.
copy d:\winpe\x86\winpe.wim d:\winpe\x86\iso\sources\boot.wim
Step 2: Mount the image
You need to mount the image so you can add packages and files to it. Use the d:\winpe\x86\mount\ directory created in Step 1.
dism /mount-wim /wimfile:d:\winpe\x86\iso\sources\boot.wim /index:1 /mountdir:d:\winpe\x86\mount
More information on DISM Command-Line options can be found here
Step 3: Add Optional Components
You can add optional components included in the WAIK using the dism /add-package command. When adding packages you must include both the language neutral and language specific package. For example
dism /image:d:\winpe\x86\mount /add-package /packagepath:"d:\waik\tools\petools\x86\winpe_fps\winpe-wmi.cab" dism /image:d:\winpe\x86\mount /add-package /packagepath:"d:\waik\tools\petools\x86\winpe_fps\en-us\winpe-wmi_en-us.cab"
For a SCCM compatible boot image you will need the following packages
- WinPE-Scripting : WSH scripting support. Required for processing deployment scripts.
- WinPE-WMI : WMI support. Required for task sequence support.
You can add the following if required.
- WinPE-HTA : HTML Application support. Required for HTA, IE scripting and HTML services.
- WinPE-MDAC : Data Access components. Required for database access from the PE environment.
- WinPE-Setup : All setup files from the \Sources folder. Required for laying down original MS images.
- WinPE-LegacySetup : Media setup feature package. Required for Windows Server 2008 R2 Installation.
- WinPE-WDS-Tools : WDS tools feature package. Required for multicast and WDS deployment scenarios.
Optional packages not specifically required
- WinPE-FONTSupport-<region> : Additional font support for : ja-JP, ko-KR, zh-CN, zh-HK and zh-TW languages.
- WinPE-PPPoE : PPPoE support to utilise PPPoE connections.
- WinPE-Setup-Client : Client setup feature package. Requires WinPE-Setup package.
- WinPE-Setup-Server : Server setup feature package. Requires WinPE-Setup package.
- WinPE-SRT : Windows Recovery Environment feature package. For automatic system diagnosis and repair.
NOTE: The WinPE-XML package is now included in the base WinPE3 WIM.
Add any other packages as necessary
dism /image:d:\winpe\x86\mount /add-package /packagepath:"d:\waik\tools\petools\x86\winpe_fps\winpe-scripting.cab" dism /image:d:\winpe\x86\mount /add-package /packagepath:"d:\waik\tools\petools\x86\winpe_fps\en-us\winpe-scripting_en-us.cab"
Verify that your packages were installed into the image
dism /image:d:\winpe\x86\mount /get-packages
NOTE: Packages will always be listed as "pending" even when the servicing operation is successful.
Step 4: Add Language / Region Support
Configure the language and time zone you want the PE to use. You can add additional language packs from the WAIK media, you will find them in the \WinPE_LangPacks directory.
To add a language pack
dism /image:d:\winpe\x86\mount /add-package /packagepath:"d:\waik\tools\petools\x86\winpe_fps\en-us\lp_en-us.cab"
To set the default language
dism /image:d:\winpe\x86\mount /set-allintl:en-US
dism /image:d:\winpe\x86\mount /set-userlocale:en-NZ dism /image:d:\winpe\x86\mount /set-syslocale:en-NZ
To set the time zone
dism /image:d:\winpe\x86\mount /set-timezone:"New Zealand Standard Time"
Verify your language settings
dism /image:d:\winpe\x86\mount /get-intl
Step 5: Add WinPE Drivers
With WinPE3 images you have the ability to add multiple drivers at once. You can add network and mass storage drivers necessary to boot your particular equipment with the following
dism /image:d:\winpe\x86\mount /add-driver /driver:d:\winpe\drivers /recurse
Step 6: Add Additional Customisations
You can add your own scripts, applications and files to your PE. Be aware that the .NET Framework is not available in the PE so .NET applications will not work, neither will 16-bit applications or some 32-bit applications in a 64-bit PE.
xcopy /e /y d:\winpe\x86\<tools> d:\winpe\x86\mount\windows\system32
xcopy /e /y d:\winpe\x86\<tools> d:\winpe\x86\iso
Interesting things to add to your Custom PE
Alternative Shell: An alternative shell environment can be anything from defaulting to running a CMD or BAT file at startup through to launching a complete shell replacement. Examples are
Aston Shell : http://www.astonshell.com/aston2/ Geoshell : http://www.geoshell.org Nu2Menu : http://www.nu2.nu/nu2menu/ BlueBox : http://blueboxshell.sourceforge.net/ (or any of the BlackBox type shells http://wiki.bb4win.org/wiki/Main_Page) ERD Commander / MS DaRT : http://technet.microsoft.com/en-us/library/ee460914.aspx Explorer++ : http://explorerplusplus.com/ Windows Explorer : Windows Explorer from Win7 / Vista Windows Command Prompt : Windows Command Prompt from Win7 / Vista
PE Tools and Utilities
SetRes : Screen resolution changer : http://www.iansharpe.com/downloads.php WinPETools by TheTruth : PENetCFG / PEShell Swapper : http://pierre.orgfree.com CMDow : CMD Prompt hider : http://www.commandline.co.uk/cmdow/ GImageX : ImageX GUI : http://www.autoitscript.com/gimagex/ Trace32 : Log file viewer : Included with ConfigMgr Toolkit
WINPESHL.INI controls whether a customised shell is loaded in the PE or the default Command Prompt window is displayed when you boot. To load a customised shell, create a file named Winpeshl.ini and place it in the d:\winpe\x86\mount\windows\system32 directory. The INI file should have the following sections and entries
[LaunchApp] AppPath = %SYSTEMROOT%\System32\<shell.exe> [LaunchApps] %SYSTEMROOT%\System32\<shell.exe>, <option>
Set the AppPath entry to the path to your shell application. You can use a fully qualified path or environment variable. The AppPath entry does not support command-line options. Use the LaunchApps section to run applications with command-line options. You can specify multiple applications to be loaded from the LaunchApps section, each application will start in the order listed. Once you exit the Command Prompt window or your customised shell application the WinPE will restart.
WPEINIT.EXE is a command-line tool that initialises the PE every boot. At boot Winpeshl.exe executes the Startnet.cmd command script, which launches Wpeinit.exe. Specifically Wpeinit.exe installs Plug and Play devices, processes Unattend.xml settings and loads network resources. Winpeinit outputs log messages to \windows\system32\wpeinit.log.
Wpeinit has one command-line option which is used to process a custom answer file.
WINPEUTIL.EXE is a command-line tool that enables you to run various commands in a PE session. Wpeutil will only accept one command per line. For example
wpeutil reboot wpeutil initializenetwork wpeutil waitforremoveablestorage wpeutil enablefirewall
See Wpeutil Command-Line Options for more information
You can also set the amount of available scratch space available once you have booted the PE for applications to use as temporary file storage
dism /image:d:\winpe\x86\mount /set-scratchspace:512
Valid values are 32, 64, 128, 256 and 512 megabytes. Use /get-scratchspace to check the value.
Step 7: Dismount / Finalise
To use the PE image you need to dismount it and commit all your changes. You can do this with the DISM /unmount-wim /commit switches.
dism /unmount-wim /mountdir:d:\winpe\x86\mount /commit
Take a copy of your environment so you can come back to it later to update it
xcopy /e /y d:\winpe\x86\ISO\sources\boot.wim d:\winpe\x86\boot-x86-v1.wim
You now have a custom WinPE3 boot image that can be deployed via CD, DVD, USB Flash Drive, PXE, etc.
SCCM RTM / SP1 Images
If you are going to import the boot image into a SCCM RTM or SP1 environment you need to finalise and export the image using the following commands
NOTE: peimg is deprecated in WAIK for Windows 7 but you can copy peimg from the WAIK v1.1.
Dismount and commit
dism /unmount-wim /mountdir:d:\winpe\x86\mount /commit
Take a copy of your SCCM PE so you can come back to it later to update it and then remount and finalise it
xcopy /e /y d:\winpe\x86\iso\sources\boot.wim d:\winpe\x86\preped-boot-x86-v1.wim dism /mount-wim /wimfile:d:\winpe\x86\iso\sources\boot.wim /index:1 /mountdir:d:\winpe\x86\mount peimg.exe /prep d:\winpe\x86\mount /f
Dismount and commit
dism /unmount-wim /mountdir:d:\winpe\x86\mount /commit
Export the custom boot image to reduce the image footprint
imagex.exe /export d:\winpe\x86\iso\sources\boot.wim 1 d:\winpe\x86\sccm-boot-x86-v1.wim "SCCM x86 Boot Image"
Note you cannot edit this WIM file after these steps. Use the backup copy (pre-finalise) if you wish to edit it again.
Step 8: Create your bootable media
You can now import your WIM file to your SCCM or PXE server or if you want to create a bootable ISO do the following
oscdimg -n -bd:\winpe\x86\etfsboot.com d:\winpe\x86\iso d:\winpe\x86\boot-x86-v1.iso
See Technet OSCDIMG Command-Line Options for more information.
Burn the ISO to your CD / DVD media and boot from CD/DVD to boot the PE.
To create a bootable USB Flash drive
Before you can place the PE on a UFD you must format the UFD using the version of DiskPart from Microsoft Vista, Windows 7 or higher.
From a running valid operating system insert your UFD. At a command prompt, use DiskPart to format the UFD as FAT32 spanning the entire UFD. For example
diskpart select disk 1 clean create partition primary select partition 1 active format quick fs=fat32 assign exit
This assumes your UFD is disk 1. You can use the list disk command in DiskPart to show you the available disks.
After preparing your UFD you need to copy the contents of your \ISO directory to the root of the UFD.
xcopy d:\winpe\x86\iso\*.* /e <ufd>:\
Where <ufd> is the drive letter your UFD has been assigned. Insert the UFD and boot your computer from USB to boot the PE.
Microsoft Technet Articles
- Technet article : Walkthrough: Create a Custom Windows PE Image
- Technet article : Walkthrough: Create a Bootable Windows PE RAM Disk on a USB Flash Disk
- Technet article : Walkthrough: Create an Optimized Windows PE Image
- Technet article : Walkthrough: Create a Windows RE Image