Netboot/Windows 7

This guide shows how to netboot a Windows 7 installation using Windows PE and allow serving both x86 and x64 images at the same time. It assumes you already have pxelinux running.

The process is divided into four parts:


 * Creating the Windows PE image which is loaded by the bootloader.
 * Creating the bootloader image which will be a single iso usable by the memdisk kernel (from syslinux) instead of bloating the TFTP server with fixed filenames.
 * Setup samba share serving installation media.
 * Configure syslinux.

Instructions loosely based on.

= Requirements =


 * Windows AIK
 * Windows 7 Repair CD (as ISO)
 * Windows 7 Installation media (as ISO)
 * Samba

= Windows PE image =

From an existing windows installation. Replace x86 with amd64 (x64, including intel) or ia64 (for intel Itanium only, if you have a core2 duo or similar use amd64)


 * 1) Install Windows AIK and run deployment console
 * 2) copype.cmd x86 C:\Path
 * 3) cd Path (If you don't want to autostart the setup or otherwise customize the environment you can skip to the last step.)
 * 4) mkdir mount
 * 5) imagex /mountrw winpe.wim 1 mount
 * 6) edit mount\Windows\System32\startnet.cmd (see below, remember to be admin or you cannot save file). Unlike optical media and usb, Windows PE will not attempt and unattended installation unless otherwise specified using the /unattended flag (e.g  /unattend:z:\Autounattend.xml).
 * 7) imagex /unmount /commit mount
 * 8) Upload winpe.wim to where you want to create boot image.

If you need any special files included in the booted environment copy them before unmounting the image, but it might be easier to access files using samba later.

 wpeinit @net use z: \\SERVER\PATH @SET PATH=%PATH%;"z:\" @echo Installation media mounted on z: @setup

= Bootloader image =


 * 1) mkdir winpe_boot temp
 * 2) mount -o loop win7_repair.iso temp
 * 3) rsync -avP temp/* winpe_boot
 * 4) perl geteltorito.pl win7_repair.iso > winpe_boot/boot.bin
 * 5) cp winpe.win bootstrap.bat bootstrap.diskpart winpe_boot
 * 6) cd winpe_boot
 * 7) mkisofs -udf -v -b boot.bin -no-emul-boot -o ../WinPE_bootstrap.iso.
 * 8) Create virtual machine which at 160MB disk (if your winpe.wim image is large you might need more) and boot using the iso you created.
 * 9) Enter command prompt and execute bootstrap script (available on disc, e.g. D:), watch output for any failures.
 * 10) Reboot to a linux live cd
 * 11) dd if=/dev/hda of=winpe.img
 * 12) scp winpe.img SERVER:DST (upload this to the tftp root)

 @echo This will erase and overwrite disk 0 with WinPE bootloader. @echo Abort now if this isn't what you intend to do. @pause diskpart /s bootstrap.diskpart c: mkdir boot copy d:\bootmgr c:\ copy d:\boot\boot.sdi c:\ copy d:\winpe.wim c:\ attrib +s +h +r c:\bootmgr bcdedit -createstore c:\boot\BCD bcdedit -import c:\boot\BCD bcdedit -create {bootmgr} /d "Boot Manager" for /f "tokens=3" %%a in ('bcdedit -create -application osloader /d "WinPE"') do set GUID=%%a bcdedit -create {ramdiskoptions} /d "Ramdisk Options" bcdedit -set {bootmgr} device partition=C: bcdedit -set {bootmgr} default %GUID% bcdedit -set {default} device ramdisk=[C:]\winpe.wim,{ramdiskoptions} bcdedit -set {default} osdevice ramdisk=[C:]\winpe.wim,{ramdiskoptions} bcdedit -set {default} path \windows\system32\boot\winload.exe bcdedit -set {default} systemroot \windows bcdedit -set {default} detecthal yes bcdedit -set {default} winpe yes bcdedit -set {ramdiskoptions} ramdisksdidevice partition=C: bcdedit -set {ramdiskoptions} ramdisksdipath \boot.sdi

 select disk 0 create partition primary select partition 1 format fs=ntfs quick active assign letter=c

= Samba =

Setup a public readable samba share containing the real installation image, e.g. mounted as loopback. Replace names, interfaces and subnets as you see fit.

 [global] workgroup = WORKGROUP server string = SERVER interfaces = eth1 bind interfaces only = Yes map to guest = Bad User hosts allow = 10.0.44., 127.

[export] path = /export guest ok = Yes

Assuming you don't change the username (see docs) the anon user will be "nobody", so setup a empty password using: smbpasswd -an nobody

= pxelinux.cfg =

LABEL Windows PE     kernel memdisk initrd winpe.img

Might have to append "raw".