These notes describe the creation of a custom
ISO, including adding drivers to the
WIM image file and creating startup scripts, in order to be able to install Windows remotely over the network. The procedure is based on Windows 7 but the instructions should be similar or identical to newer Windows releases.
One of the motivations is that, contrary to most Linux
ISOs, such as the Debian net-installer, Windows is distributed as a
DVD, which would be impossible to load via
MEMDISK driver as described in our networking section.
Note that this tutorial proceeds by building the
WinPE image on Windows. Although Linux has the
mkwinpeimg command that can generate a
WinPE image, the
mkwinpeimg command does not support injecting drivers (just overlaying them) which will not make the booted
WinPE image auto-load the installed drivers.
ISOis downloaded, choose
Windows AIK Setupand install the
For the rest of the tutorial the
Deployment Tools Command Prompt is needed. It can be launched by going to
Start→All Programs→Microsoft Windows AIK and then right-click the
Deployment Tools Command Prompt and select
Run as administrator.
in the newly opened command shell, we first create the
copype amd64 c:\winpe_amd64
Next, to modify the
WinPE boot image (
WIM) we need to mount it:
dism /Mount-Wim /WimFile:"C:\WinPE_amd64\winpe.wim" /index:1 /MountDir:"C:\WinPE_amd64\mount"
In order to list the current installed drivers, issue:
dism /image:"c:\winpe_amd64\mount" /get-drivers
The following a sample output of the
virtio network drivers installed in the
Deployment Image Servicing and Management tool Version: 6.1.7600.16385 Image Version: 6.1.7600.16385 Obtaining list of 3rd party drivers from the driver store... Driver packages listing: Published Name : oem0.inf Original File Name : netkvm.inf Inbox : No Class Name : Net Provider Name : Red Hat Inc. Date : 4/29/2014 Version : 126.96.36.19900 The operation completed successfully.
In order install a driver (
INF) in the WinPE image, issue:
dism /image:"c:\winpe_amd64\mount" /add-driver /driver:"C:\drivers\netkvm.inf"
To remove drivers, first list the drivers and capture the
INF name (not the driver
INF) and then issue:
dism /image:"c:\winpe_amd64\mount" /remove-driver /driver:oem0.inf
You can also batch-install a bunch of drivers from a directory. Suppose you create a directory
c:\drivers where you store all the drivers you want to install onto the
WIM image, you would then issue:
which recurses the
c:\drivers folder and installs all the drivers (
.inf files) into the
WIM image. You can get a bundle of popular network drivers from our WinPE asset page.
Create a file named
c:\winpe_amd64\mount\windows\system32 with the following contents:
[LaunchApp] AppPath = %SYSTEMDRIVE%\install.cmd
this will run
c:\windows\system32\install.cmd on boot.
Now we can create
c:\winpe_amd64\mount\windows\system32\install.cmd to contain some commands. For example, to mount a
samba share and start an installation, the
install.cmd file would contain:
wpeinit.exe netcfg.exe -winpe ping.exe -n 11 127.0.0.1 > nul net.exe use i: \\samba.server\tftp\install\windows i:\setup.exe
Which performs in order:
pingto pause for
timeout, etc… Are not available).
Unmount image and commit the changes:
dism /Unmount-Wim /MountDir:"C:\WinPE_amd64\mount" /commit
Or, you can unmount and discard the changes:
dism /Unmount-Wim /MountDir:"C:\WinPE_amd64\mount" /discard
Now, copy the customised image:
copy c:\winpe_amd64\winpe.wim c:\winpe_amd64\ISO\sources\boot.wim
ISO from the customised image:
oscdimg -n -bc:\winpe_amd64\etfsboot.com c:\winpe_amd64\ISO c:\winpe_amd64\winpe_amd64.iso
A complete kitchen for generating Windows 7 PE images can be created by writing a script that will pull all the relevant ISO files, allow the user to create or edit a
startnet.cmd script and then generate a WinPE image for use with PXE.
To use the kitchen simply type:
and the process will be started.