.TH MKWINPEIMG "1" "September 2022" "wimlib 1.13.6" "User Commands"
.SH NAME
mkwinpeimg \- Make a customized bootable image of Windows PE
.SH SYNOPSIS
.B mkwinpeimg
[\fIOPTIONS\fR] \fIIMAGE\fR
.SH DESCRIPTION
\fBmkwinpeimg\fR 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 \fB--windows-dir\fR and \fB--waik-dir\fR options are used to
specify the locations of these mounted ISOs.  You only need one or the other.
The files that \fBmkwinpeimg\fR will retrieve are \fIboot.wim\fR, \fIbootmgr\fR,
\fIboot.sdi\fR, and \fIbcd\fR.  If making an ISO image, the file
\fIetfsboot.com\fR is also retrieved.  Microsoft owns the rights to these files
and they are not distributed with wimlib.
.PP
\fBmkwinpeimg\fR 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.  \fBsyslinux\fR(1) is required to make this type of image, as it is
used to chainload \fIbootmgr\fR. Also, \fBmtools\fR(1) is required so that the
FAT filesystem can be created without root privileges.
.PP
The other type of bootable image that \fBmkwinpeimg\fR can make is a bootable
ISO image.  To make this type of image, give the \fB--iso\fR option.
\fBmkisofs\fR(1) is required to make this type of image.  In \fB--iso\fR mode,
you can specify \fIIMAGE\fR as "-" to write the ISO image to standard output.
.PP
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.
.PP
Windows PE itself is contained in the \fIboot.wim\fR file.  \fBmkwinpeimg\fR 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 \fB--start-script\fR \fIFILE\fR option to
specify such a file.  You may also add arbitrary files to \fIboot.wim\fR by
putting them in a directory, then specifying the \fB--overlay\fR \fIDIR\fR
option.  However, for more extensive modifications, consider modifying the
\fIboot.wim\fR file separately using \fBwimmountrw\fR(1) or \fBwimupdate\fR(1),
then providing it to \fBmkwinpeimg\fR using the \fB--wim\fR option.
.PP
\fBmkwinpeimg\fR can also make only a modified \fIboot.wim\fR, rather than a
bootable ISO or disk image, if the \fB--only-wim\fR option is given.
.SH OPTIONS
.TP 6
\fB\-i\fR, \fB\-\-iso\fR
Make an ISO image instead of a disk image.
.TP
\fB\-o\fR, \fB\-\-only-wim\fR
Make neither a disk image nor an ISO image; instead, only make a modified
\fIboot.wim\fR file.
.TP
\fB\-W\fR, \fB\-\-windows\-dir\fR=\fIDIR\fR
Use DIR as the location of the mounted Windows installation ISO image.  If
neither \fB\-\-windows\-dir\fR nor \fB\-\-waik\-dir\fR is specified, then
the script looks for the mounted ISO in the following default locations:
/mnt/windows, /mnt/windows7, /mnt/windows8, and /mnt/windows10.
.TP
\fB\-A\fR, \fB\-\-waik\-dir\fR=\fIDIR\fR
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.
.TP
\fB\-s\fR, \fB\-\-start\-script\fR=\fIFILE\fR
Add FILE to the root directory of Windows PE image and adjust
\eWindows\eSystem32\ewinpeshl.ini to execute FILE when Windows PE starts up.
.TP
\fB\-w\fR, \fB\-\-wim\fR=\fIWIM\fR
Use WIM as the "boot.wim" file.  This defaults to the appropriate WIM file from
the Windows ISO, WAIK, or WAIK supplement.
.TP
\fB\-O\fR, \fB\-\-overlay\fR=\fIDIR\fR
Adds all the files in DIR to the Windows PE image.
.TP
\fB\-t\fR, \fB\-\-tmp\-dir\fR=\fIDIR\fR
Use DIR for temporary files.  Defaults to a directory made using "mktemp -d".
.TP
\fB\-a\fR, \fB\-\-arch\fR=\fIARCH\fR
Use the Windows PE version from the Windows Automated Installation Kit (or the
WAIK supplement) that has the CPU architecture \fIARCH\fR.  Only valid with
\fB\-\-waik\-dir\fR.  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.
.TP
\fB\-h\fR, \fB\-\-help\fR
Display help.
.TP
\fB\-v\fR, \fB\-\-version\fR
Show version information.
.SH EXAMPLES
Create a bootable disk image of Windows PE from the Windows (Vista or later)
installation media mounted on /media/windows:
.RS
.PP
mkwinpeimg --windows-dir=/media/windows winpe.img
.RE
.PP
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:
.RS
.PP
mkwinpeimg --iso --waik-dir=/media/waik --overlay=winpe_overlay winpe.iso
.RE
.PP
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.
.RS
.PP
mkwinpeimg --start-script=install.cmd --windows-dir=/media/windows /var/tftpboot/winpe.img
.RE
.PP
.SH 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.
.SH REPORTING BUGS
Report bugs to \fIhttps://wimlib.net/forums/\fR.
.SH SEE ALSO
.BR wimlib-imagex (1)