PXE boot WinPE 2 (Vista) using Linux as the PXE Server
Spent a little while trying to get WinPE2 (Vista) to boot via PXE from a linux server and thought it could be useful to someone. We already had our Red Hat stuff booting from there and it seemed like a good idea to keep it in one place!
Some of the stuff could be useful for booting via PXE from a Windows box too
Windows XP was used for WAIK stuff
Fedora Core 6 was used for PXE Server
Both running on VMWare Server along with a blank VMWare machine as the PXE client
* Note – there’s a bug in RHEL5 that’s stop’s the tftpd.remap file working. Not sure how many versions this affects
Install a Linux Server
I’m using a NAT VM to keep the DHCP server off of the LAN
Do a minimum install – we will install the required packages later
I’m using DHCP to give the server an IP address for testing but will need a static IP address assigning
I’m not using a firewall or SELinux – you might need to alter your install to accommodate them
On your linux PXE server
Ensure that the DHCP server is installed
Edit /etc/dhcpd.conf for your environment. Here’s mine -
ignore client-updates;
allow booting;
allow bootp;
class "pxeclients" {
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
next-server 172.16.54.128;
filename "Boot/pxelinux.0";
}
subnet 172.16.54.0 netmask 255.255.255.0 {
option routers 172.16.54.2;
range dynamic-bootp 172.16.54.10 172.16.54.15;
default-lease-time 600;
max-lease-time 7200;
}
Install tftp-server
Install syslinux
Copy pxelinux.0 from the syslinux install to /tftpboot
Create a folder to hold the PXE config file
Create a PXE config file – /tftpboot/pxelinux.cfg/default – Here’s mine -
timeout 100
prompt 1
label 1
kernel Boot/startrom.0
append -
Create a tftp remap file. This is used to translate back slashes to forward slashes. /tftpboot/tftpd.remap. This should just contain a single line
Enable the tftp server by editing the following file – /etc/xinitd.d/tftp. Also make it use the remap file. The -vvv is optional but it could definitely help later on! Here’s mine -
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot -m /tftpboot/tftpd.remap -vvv
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
Start the DHCP server
Start the TFTP server
Download the Windows Automated Installation Kit – http://www.microsoft.com/downloads/details.aspx?FamilyID=c7d4bc6d-15f3-4284-9123-679830d629f2&DisplayLang=en
The file is an ISO file so can be renamed to .iso and mounted using either vmware or one of the free tools (magiciso?) so that the install can be run
On to a Windows XP machine now …
From the install CD you just downloaded
Install the .NET Framework Setup
Install the MSXML 6.0 Setup
Install the Windows AIK Personally I did it to c:\waik to save typing too much!
Run the copype command to create your PE folder
copype.cmd x86 c:\vistape
Mount the .wim image
imagex /mountrw winpe.wim 1 mount
Create a folder to store the PXE stuff
Copy the PXE stuff to the pxe folder
copy * \pxe
cd \vistape\mount\windows\boot\fonts
copy wgl4_boot.ttf \pxe
cd \waik\tools\petools\x86\boot
copy boot.sdi \pxe
cd \vistape
copy winpe.wim \pxe
OK – now the fun bit. Create the BCD file. This is a replacement for the boot.ini
bcdedit /createstore \pxe\BCD
bcdedit /store \pxe\bcd /create {ramdiskoptions} /d "Ramdisk options"
bcdedit /store \pxe\bcd /set {ramdiskoptions} ramdisksdidevice boot
bcdedit /store \pxe\BCD /set {ramdiskoptions} ramdisksdipath \Boot\boot.sdi
bcdedit /store \pxe\BCD /create /d "MyWinPE Boot Image" /application osloader
You should get a GUID returned – not sure what you need to do if not I’m afraid! Replace the GUIDs below with the GUID you get back
The entry {ed26a7d4-0ed5-11dc-9d1a-000c29ea1605} was successfully created.
bcdedit /store \pxe\BCD /set {ed26a7d4-0ed5-11dc-9d1a-000c29ea1605} detecthal Yes
bcdedit /store \pxe\BCD /set {ed26a7d4-0ed5-11dc-9d1a-000c29ea1605} winpe Yes
bcdedit /store \pxe\BCD /set {ed26a7d4-0ed5-11dc-9d1a-000c29ea1605} osdevice ramdisk=[boot]\Boot\WinPE.wim,{ramdiskoptions}
bcdedit /store \pxe\BCD /set {ed26a7d4-0ed5-11dc-9d1a-000c29ea1605} device ramdisk=[boot]\Boot\WinPE.wim,{ramdiskoptions}
bcdedit /store \pxe\BCD /create {bootmgr} /d "Windows VISTA BootManager"
bcdedit /store \pxe\BCD /set {bootmgr} timeout 30
bcdedit /store \pxe\BCD /displayorder {ed26a7d4-0ed5-11dc-9d1a-000c29ea1605}
ok – nearly all done now. You need to copy all the files from your \pxe folder to your linux PXE server. I use winscp. Copy the files to a folder call /tftpserver/Boot (case is important!) I had some fun trying to do this with Vmware but that could have been a problem unique to me!
Back on the linux server … Just got to rename a few files
mv pxeboot.n12 startrom.0
mv bootmgr.exe ..
mv winpe.wim WinPE.wim
Now PXE boot a machine and press 1 (obviously you can make syslinux look much nicer with some menus and things!). Fingers crossed you should get a Windows PE 2 console.
A few extra bits …
If you want to boot a Vmware machine via PXE and connect to the network you’ll need the Vmware network drivers in your .wim file. This is surprisingly easy to do thanks to being able to edit the .wim file easily.
From your Windows XP Vmware client (or you’ll need to find the vm network drivers from somewhere)
imagex /mountrw winpe.wim 1 mount (you may have this done from above already)
peimg /inf="C:\Program Files\VMware\VMware Tools\Drivers\vmxnet\vmware-nic.inf" \vistape\mount
peimg /inf="C:\Program Files\VMware\VMware Tools\Drivers\vmxnet\vmxnet.inf" \vistape\mount
imagex /unmount /commit \vistape\mount
Now you can copy your winpe.wim file to your PXE server and overwrite the old one. Make sure you change the case of the file again to WinPE.wim
Hopefully this is going to work for all sorts of drivers – raid, network, etc Also, you can obviously put anything else that you need in the .wim file.
Related posts:

Hemlock:
Thanks for your article. Great Job.
One thing to mention:
The filename line in dhcpd.conf should read:
filename “pxelinux.0″;
and not
filename “Boot/pxelinux.0″
This is what I needed for Debian and dhcp3-server.
All worked great after that.
Cheers!
18 January 2008, 12:31 amNick:
Hi,
Thanks for such a nice article. I am getting 1 error .. can you help.
while doing pxe boot it says
WINDOWS FAILED to start .. this might be due to recent change in hardware or software.
1. insert disk and try.
2. select languare and ..
3. …
File BCD
unable to read Boot configuration file data.
27 August 2008, 9:32 ammatt:
Hi Nick,
Did you make sure that you kept the filename BCD in upper case?
The only other thing I can think is to turn on logging on the TFTP server (I did this when I was testing – it made tracking down problems a lot easier) At least then you’ll be able to see what file the client is asking for and what the error is.
Matt
27 August 2008, 9:42 amBob:
This left me with a “BlInitializeLibrary failed 0xc0000001″ error after downloading bootmgr.exe. Ever see that?
17 September 2008, 4:31 pmmatt:
Hi Bob,
I’ve not seen that before I’m afraid. Is this on hardware that Vista will normally install on?
Matt
18 September 2008, 8:34 amPascal Vandeputte:
I got exactly the same error messages as Nick, my mistake was that I was deploying WinPE on a tftp/netboot server I’ve been maintaining for a couple of years now and I hadn’t noticed that I had to add the “-m /var/lib/tftpboot/tftpd.remap” part to my inetd.conf file.
For that reason the BCD file was never found because the remapping didn’t work.
Another note: my setup seems to be looking for wgl4_boot.ttf in \Boot\Fonts , not in \Boot (which is where it ends up if you follow your instructions exactly).
Anyway, thanks a LOT for your clear instructions, they were a huge help in getting this right!
11 December 2008, 3:09 pmmatt:
Hi Pascal,
Many thanks for the comments – they are very useful. There’s certainly a lot of different bits to get it all working together and any tips are definitely welcomed
I’m glad the post helped some. Matt
11 December 2008, 3:16 pmluk:
very clear instructions
great help
Thanks!
14 December 2008, 11:09 amKashif:
your screen shots are missing for some reason, did you move them?
31 December 2008, 2:18 pmmatt:
Thanks Kashif. A wordpress plugin update had messed something up. Hopefully you can see them now. Matt.
31 December 2008, 4:28 pmharm:
nice howto, but after a quick-run im a bit confused on where to actually put the vista-dvd files and the unattended.xml file? Also, the pxe boot seems to hang and eventually reboot when running with 512mb ram. Im testing in ESXi and upgrading the Vista VM to 1GB ram gave a nice vista background with a dosbox stating ‘wpeinit’.
4 January 2009, 5:23 pmharm:
think ive got it, this is only the step BEFORE the actual windows setup… From the given shell i would network mount a share pointing to a Vista-DVD and start setup.exe from there. Only need to figure out howto use autounattended.xml
6 January 2009, 6:01 pmmatt:
Hi harm,
, you still have to run the Vista install once you’ve got WinPE booted. I’m afraid I’m not sure where you need to put the autounattended.xml file. Maybe you can specify where it is on the command line for the install program? Matt.
7 January 2009, 8:31 amThat’s correct, the instructions above are really just a complicated network boot disk
PXE Booting Vista/PE 2.0 Using PXELINUX.0 | keyongtech:
[...] Server 2003 is already working. I havn’t finished this walk through yet, but it looks promising: http://sysadminman.net/blog/archives/8 — kai4785 ———————————————————————— kai4785’s [...]
18 January 2009, 11:39 amAndy Slezak:
also note in the /etc/dhcpd.conf file, you need to specify the correct dhcpd server for the ‘next-server’ argument. If you copy and paste (as I did), you will receive an arp timeout.
13 February 2009, 9:39 pmwedge:
Hello,
did someone find out how to install Windows Vista and how to use the unattended-xml-file?
19 March 2009, 9:53 amMolski:
Thanks for sharing this, works great (so far…
).
I also had the remapping issue on RHEL5.3 (CentOS 5.3), I downloaded the 0.48 version of the tftp-server RPM for Fedora Core 10 from here:
ftp://ftp.univie.ac.at/systems/linux/fedora/releases/10/Everything/i386/os/Packages/tftp-server-0.48-6.fc10.i386.rpm
The file installs (updates) flawless, after that mapping worked without ANY changes to one of my files!
Now I only have to find out how to kickstart a W2K8 installation from this point on
Thanks again,
Molski
25 May 2009, 1:11 pmRichard Ruddock:
thanks for the setup guide. works a treat. I’ve now got my WinPE image running from PXE. Saves a load of hassle for my ghosting cycles (not using ghostcasting)
thanks a million!!
Richard
26 June 2009, 10:52 ammatt:
Hi Richard. I’m glad it helped and thanks for taking the time to leave a comment. I really appreciate it. Regards, Matt
27 June 2009, 4:51 amJoel:
Thanks Matt
One thing i changed to slightly improve it
I renamed the “Boot” Folder to vistape so i knew what it was later
To enable this to boot i made added to the tftpd.remap file
#——-File Start——-#
gr \\ /
gr Boot vistape
#——-File End——-#
That just makes trying to remember what the folders are in my tftp server Easier
But Thanks alot
12 July 2009, 6:54 pmmatt:
Good tip! Thanks Joel.
12 July 2009, 7:31 pmKashif:
Matt:
Is there any way to to change or hack the directory name “Boot” where the files are stored? I want to have multiple Boot directories for some reason. I know I can have multiple entries boot entries that I can pick in the BCD menu but I want to create different Boot directories and be able to boot in those. I created Boot2 but when I boot using PXE it still boots from the Boot directory instead, any hints?
Kashif
15 July 2009, 11:42 pmmatt:
Hi Kashif, I’m afraid I don’t. It was a while ago that I’ve looked at this now but I’m pretty sure that directory name was hard coded. Matt.
16 July 2009, 9:09 ammt:
How to configure tftp.remap on ubuntu tftp server?, thank a lot for your help!
17 August 2009, 9:13 pmmt:
i’ve resolved my question… i create a file /etc/tftpd-hpa.rules whith this:
17 August 2009, 10:14 pm——–
rg \\ /
——–
and declare de option in the file /etc/default/tftp-hpa whit this:
————-
options:”-l -s /var/lib/tftpboot -m /etc/tftpd-hpa.rules -vvv”
———-
and resolve the error “….Boot\BCD…”, when boot winpe
Sorry for my english.
cheers..
matt:
Thanks for the update. Hopefully it will help somebody else. Matt.
18 August 2009, 8:53 amrama krushna sahu:
gr \\ /
18 August 2009, 2:44 pmthis should be in RedHat
rg \\ /
rama krushna sahu:
Can I set the IP using netsh command for winpe.
I tried but I am getting errors like
“The file name, directory name, or volume level syntax is incorrect”
This seems to be a syntax error. I tested with several changes using this command it is showing same above error.
20 August 2009, 12:12 pmCyril:
It’s not always the case of /Boot/BCD and I got /boot/bcd in my box.
28 September 2009, 11:18 pmNick’s problem can be found out with tftpd server started with -vvv option and
get the real file name that pxeboot.n12(startrom.0) wants
in /var/log/daemon.log or /var/log/syslog
domi235:
A very big thank you for this awesome tutorial! _/-\o_
9 October 2009, 1:21 pmLu:
Great Job, i’ve just a question, With this project could i start windows and linux in the terminals?, i mean the user choose OS (Linux or Windows) work.
Best regards, and thanks for your help.-
30 October 2009, 1:59 pmmatt:
Yes, you could boot up either Linux or Windows from PXE with the user choosing at the menu which one to boot (/tftpboot/pxelinux.cfg/default)
30 October 2009, 8:36 pmgull:
Thanks for putting together such a good tutorial – great work!
Just thought i’d add that if you are adding drivers to the winpe.wim file under Server 2008/Windows 7,
“peimg” has been replaced with the slightly more convoluted command “dism”.
So, the process for adding the drivers in your example would be:
C:> dism /Mount-Wim /WimFile:C:\win7pe\winpe.wim /index:1 /MountDir:C:\win7pe\mount
C:> dism /Image:C:\win7pe\mount /Add-Driver /Driver:”C:\Program Files\VMware\VMware Tools\Drivers\vmxnet\vmware-nic.inf”
C:> dism /Image:C:\win7pe\mount /Add-Driver /Driver:”C:\Program Files\VMware\VMware Tools\Drivers\vmxnet\vmxnet.inf”
C:> dism /Unmount-Wim /MountDir:C:\win7pe\mount /commit
Note: you *must* have mounted the image using “dism” and not “imagex” for the “dism /Add-Driver” commands to operate.
27 January 2010, 3:50 pm