mkwinpeimg - Man Page

Make a customized bootable image of Windows PE

Synopsis

mkwinpeimg [Options] IMAGE

Description

mkwinpeimg is able to make a bootable image of Windows PE by taking files from a mounted Windows installation ISO image (Vista or later) or the mounted ISO image for the Windows Automated Installation Kit (WAIK) or the WAIK supplement.  The --windows-dir and --waik-dir options are used to specify the locations of these mounted ISOs.  You only need one or the other. The files that mkwinpeimg will retrieve are boot.wim, bootmgr, boot.sdi, and bcd.  If making an ISO image, the file etfsboot.com is also retrieved.  Microsoft owns the rights to these files and they are not distributed with wimlib.

mkwinpeimg can make two types of bootable images.  The default is to make a bootable disk image.  The image is not partitioned and is formatted into a FAT filesystem.  syslinux(1) is required to make this type of image, as it is used to chainload bootmgr. Also, mtools(1) is required so that the FAT filesystem can be created without root privileges.

The other type of bootable image that mkwinpeimg can make is a bootable ISO image.  To make this type of image, give the --iso option. mkisofs(1) is required to make this type of image.  In --iso mode, you can specify IMAGE as "-" to write the ISO image to standard output.

If you make a disk image, you could put it on a USB drive, and if you make an ISO image, you could put it on a CD.  In addition, both types of images can be loaded by the SYSLINUX or PXELINUX bootloaders using the MEMDISK module.

Windows PE itself is contained in the boot.wim file.  mkwinpeimg can modify this file before embedding it in a bootable image.  The most useful modification is to specify an executable or batch file for Windows PE to execute as soon as it starts up.  Use the --start-script FILE option to specify such a file.  You may also add arbitrary files to boot.wim by putting them in a directory, then specifying the --overlay DIR option.  However, for more extensive modifications, consider modifying the boot.wim file separately using wimmountrw(1) or wimupdate(1), then providing it to mkwinpeimg using the --wim option.

mkwinpeimg can also make only a modified boot.wim, rather than a bootable ISO or disk image, if the --only-wim option is given.

Options

-i,  --iso

Make an ISO image instead of a disk image.

-o,  --only-wim

Make neither a disk image nor an ISO image; instead, only make a modified boot.wim file.

-W,  --windows-dir=DIR

Use DIR as the location of the mounted Windows installation ISO image.  If neither --windows-dir nor --waik-dir is specified, then the script looks for the mounted ISO in the following default locations: /mnt/windows, /mnt/windows7, /mnt/windows8, and /mnt/windows10.

-A,  --waik-dir=DIR

Get the boot files and boot.wim from the ISO of the Windows Automated Installation Kit mounted on DIR instead of from a Windows installation ISO. This also works if the mounted ISO is for the WAIK supplement rather than the WAIK itself.

-s,  --start-script=FILE

Add FILE to the root directory of Windows PE image and adjust \Windows\System32\winpeshl.ini to execute FILE when Windows PE starts up.

-w,  --wim=WIM

Use WIM as the "boot.wim" file.  This defaults to the appropriate WIM file from the Windows ISO, WAIK, or WAIK supplement.

-O,  --overlay=DIR

Adds all the files in DIR to the Windows PE image.

-t,  --tmp-dir=DIR

Use DIR for temporary files.  Defaults to a directory made using "mktemp -d".

-a,  --arch=ARCH

Use the Windows PE version from the Windows Automated Installation Kit (or the WAIK supplement) that has the CPU architecture ARCH.  Only valid with --waik-dir.  Possible values: "x86" or "amd64".  Default is "x86". Note: the WAIK also contains a Windows PE image for the ia64 (Itanium) architecture; however, this is not supported by this script.

-h,  --help

Display help.

-v,  --version

Show version information.

Examples

Create a bootable disk image of Windows PE from the Windows (Vista or later) installation media mounted on /media/windows:

mkwinpeimg --windows-dir=/media/windows winpe.img

Create a bootable ISO of Windows PE from the WAIK (or WAIK supplement) mounted on /media/waik, and add all the files in "winpe_overlay" to Windows PE's filesystem:

mkwinpeimg --iso --waik-dir=/media/waik --overlay=winpe_overlay winpe.iso

Create a bootable image of Windows PE from the Windows installation media mounted on /media/windows, add and make it execute "install.cmd" when it starts up.  In this example the image is created in the root directory of the TFTP server for network booting.

mkwinpeimg --start-script=install.cmd --windows-dir=/media/windows /var/tftpboot/winpe.img

Notes

Microsoft's licenses may limit the things that Windows PE can be used for, and they may limit your rights to redistribute customized versions of Windows PE.

Reporting Bugs

Report bugs to https://wimlib.net/forums/.

See Also

wimlib-imagex(1)

Info

February 2024 wimlib 1.14.4