Automated Windows Server 2008R2 installation from a Linux server without machine imaging

This example uses ‘’ running Fedora 14 and ‘’ in a virtual machine. It is a fully automated install that doesn’t involve machine imaging and doesn’t require you to access the target server’s console.

Install tftp+dhcp+samba RPMs:

yum install tftp
yum install tftp-server
yum install dhcp
yum install samba

Configure tftpd

Edit /etc/xinetd.d/tftp to add “-m /etc/” to server_args

echo ‘rg \ /’ > /etc/

Configure Samba

mkdir /data
chown 777 /data

Create /etc/samba/smb.conf

workgroup = VC
server string = Samba Server Version %v
log file = /var/log/samba/log.%m
max log size = 50
security = share
guest account = nobody

path = /data
guest ok = yes
writable = yes
browsable = yes
printable = no

Configure dhcpd

Create /etc/dhcp/dhcpd.conf

allow booting;
allow bootp;

option domain-name “”;
option subnet-mask;
option domain-name-servers;

shared-network vc {
  subnet netmask {
    option routers;
group {
  filename “\Boot\pxeboot.n12”;
  host { hardware ethernet 52:54:00:f4:2f:20; }

Modify the “host” entry to match the MAC address of the target server

Install Windows AIK on the Technician computer

Copy boot files to the PXE server

Start the Deployment Tools Command Prompt

Create the WinPE directory structure: c:>copype.cmd amd64 c:winpe_amd64

Mount the WinPE image: c:winpe_amd64>dism /mount-wim /wimfile:winpe.wim /mountdir:mount /index:1

Install the setup packages: c:winpe_amd64>dism /image:mount /add-package /packagepath:”c:program fileswindows” c:winpe_amd64>dism /image:mount /add-package /packagepath:”c:program fileswindows” c:winpe_amd64>dism /image:mount /add-package /packagepath:”c:program fileswindows” c:winpe_amd64>dism /image:mount /add-package /packagepath:”c:program fileswindows”

Rebuild lang.ini: c:winpe_amd64>dism /image:mount /gen-langini /distribution:mount

Create winpeshl.ini (to prevent winpe launching setup.exe immediately): c:winpe_amd64mount>cd winpe_amd64mountwindowssystem32 c:winpe_amd64mountWindowsSystem32>notepad winpeshl.ini

Insert the text below into winpeshl.ini: [LaunchApp] AppPath = %SystemRoot%system32startnet.cmd

Edit startnet.cmd (prevents the builtin setup.exe from using WDS): C:datawinpe_amd64mountWindowsSystem32>notepad startnet.cmd

Insert the text below into startnet.cmd: wpeinit reg delete HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlPXE /f x:setup.exe /unattend:bootsrv.example.comdataautounattend.xml

Copy the PXE boot files to c:winpe_amd64>net use n: bootsrv.example.comdata c:winpe_amd64>mkdir n:Boot c:winpe_amd64>copy mountwindowsbootpxe. n:Boot c:winpe_amd64>copy “c:program fileswindows aiktoolspetoolsamd64bootboot.sdi” n:boot

Unmount the WinPE image (ensure all explorer windows are closed): c:winpe_amd64mountWindowsSystem32>cd winpe_amd64 c:winpe_amd64>dism /unmount-wim /mountdir:mount /commit

Copy the image to c:winpe_amd64>copy winpe.wim n:Bootboot.wim

Configure BCD Store: c:winpe_amd64>bcdedit -createstore BCD c:winpe_amd64>bcdedit -store BCD -create {ramdiskoptions} /d “Ramdisk Options” c:winpe_amd64>bcdedit -store BCD -set {ramdiskoptions} ramdisksdidevice boot c:winpe_amd64>bcdedit -store BCD -set {ramdiskoptions} ramdisksdipath Bootboot.sdi c:winpe_amd64>bcdedit -store BCD -create /d “WinPE Boot Image” /application osloader

Use the GUID returned from this command in place of {GUID} in the following commands: c:winpe_amd64>bcdedit -store BCD -set {GUID} systemroot Windows c:winpe_amd64>bcdedit -store BCD -set {GUID} detecthal Yes c:winpe_amd64>bcdedit -store BCD -set {GUID} winpe Yes c:winpe_amd64>bcdedit -store BCD -set {GUID} osdevice ramdisk=[boot]Bootboot.wim,{ramdiskoptions} c:winpe_amd64>bcdedit -store BCD -set {GUID} device ramdisk=[boot]Bootboot.wim,{ramdiskoptions} c:winpe_amd64>bcdedit -store BCD -create {bootmgr} /d “Windows Boot Manager” c:winpe_amd64>bcdedit -store BCD -set {bootmgr} timeout 30 c:winpe_amd64>bcdedit -store BCD -displayorder {GUID} c:winpe_amd64>copy BCD n:Boot

Move /data/Boot to /var/lib/tftpboot/Boot on [root@bootsrv ~]# mv /data/Boot /var/lib/tftpboot/Boot

Copy the DVD install.wim to c:winpe_amd64>copy e:sourcesinstall.wim n:win2008r2.wim

Create the unattended xml file in /data/autounattend.xml. This example can be edited with the Windows System Image Manager. It will perform these actions:

  • Create two partitions (system and windows)
  • Install Windows Server 2008R2 Datacenter Server (use the value Windows Server 2008 R2 SERVERDATACENTERCORE in the XML to get Server Core)
  • Name the server ‘dev1’
  • Join the domain ‘VC’ using the username ‘djoin’ and password ‘djoin’ in the OU ou=application servers,dc=vc,dc=example,dc=com
  • Set the local administrator password to ‘password1’

Product key should be changed from ZZZZZ-ZZZZZ-ZZZZZ-ZZZZZ-ZZZZZ









                            Windows Server 2008 R2 SERVERDATACENTER





                ou=application servers,dc=vc,dc=example,dc=com



Boot the VM

It should boot WinPE, install, and the last reboot will bring it up as a domain joined server

The domain group policies will automatically apply (eventually), so if you have Remote Desktop enabled then you’ll be able to RDP into the server at this point. Otherwise you can log into the machine’s console and run “gpupdate /boot /sync” to get the policies to apply asap.


Leave a Reply

Your email address will not be published. Required fields are marked *

Comment replies are not available offline


“Copy the boot files to PXE server”, for this do we use wimextract to get the boot files or can we get it from the folder of WAIK?

Thanks in advance

on August 25, 2015 at 11:11 pm Reply |

Nice howto, this works, but i have a question.

I’d like to get my autounattended.xml via curl http request and save it to use it for the installer instead of using samba. Hence, i included curl binary to my winpe.wim, and updated my startcmd.cmd to call curl with my url where my script generates my xml file and save it to X:windowstemp.

curl -o X:Windowstempautounattend.xml
x:setup.exe /unattend:X:Windowstempautounattend.xml

This works until the Installer reboots the first time, after that, my downloaded File is of course vanished, it is looked up in C:WindowsPantherunattend.xml – is there a way to copy my downloaded unattend.xml file to the new installation before setup wants to reboot automatically?

on December 22, 2014 at 9:28 pm Reply |

According to – “a copy of this answer file is cached on the computer” – Setup should have done that for you. Maybe try the /noreboot flag in startcmd.cmd, and check the setup logs? When setup.exe is running (and failing) you can press Shift-F10 and then look on the disk for the setupact.log file. Possibly setup.exe might also say “the file doesn’t exist” when actually there’s a problem with the file or the parameters in it. Hope that helps!

on December 23, 2014 at 2:21 pm Reply |

Hi Chrisl,

Can I try your guide to unattend install Windows 2K8 using PXElinux installed on a RHEL5?

I haved used a winpe.iso guide to deploy but it not works.

default linux
label PXElinux
localboot 0
timeout 300
default menu.c32

menu title Boot Menu DEMOLAB

label RHEL 5.5 64bit Script
menu label 1) RHEL-5.5-^64bit Script
kernel RHEL5.5_64bit/vmlinuz
append initrd=RHEL5.5_64bit/initrd.img method= ks=

label RHEL 5.5 32bit Script
menu label 2) RHEL-5.5-^32bit Script
kernel RHEL5.5_32bit/vmlinuz
append initrd=RHEL5.5_32bit/initrd.img method= ks=

label Windows 2k8 64bit
menu label 3) ^Windows-DC-EE-SE-Web-R2-2K8-64bit
kernel memdisk
initrd winpe/winpe.iso
append iso initrd=winpe/winpe.iso raw

on November 27, 2013 at 3:51 am Reply |

Greetings, Chris

I’m trying to unattend install Windows 2K8 using PXElinux from a kick server (RHEL 5.11). I’m trying to perform the task with as well as without using WAIK. May I request you to let me know if you had used WAIK and any suggestion would be really appreciated in this regard.

Thanks in advance

on August 12, 2015 at 6:20 pm Reply |

Excellent. Got it all working. Thank you for your help on this!

One quick last question….do you know if I can add a couple msi’s to be installed during initial setup? I have a 2 programs that are *.msi that need installed.

on August 12, 2011 at 7:42 pm Reply |

If you’ve got software packaged as MSIs then I would install those post-deployment using a Group Policy, or via System Center Configuration Manager if you have that available.

on August 14, 2011 at 12:03 pm Reply |


Are the driver files supposed to be in that datawindowsdriver? That folder isn’t even there. I am thinking that file didn’t get copied to the pxe server.

on August 12, 2011 at 5:05 pm Reply |

No, you have to create that folder structure. Any drivers that you want to be available to the OS on first boot should be put in there. The setup process only installs drivers from the WinPE image into the OS that are critical to the boot process (like disk controllers), it doesn’t copy ones that aren’t (like network drivers) unless they’re in that directory. Setup doesn’t actually install the drivers in that directory, the first boot installs them if they’re needed.

on August 12, 2011 at 5:53 pm Reply |

We are using the VMware SCSI driver. I have tried the other options for SCSI with no luck. We are now going to try to switch to IDE. So the problem you think is the driver built into the wim file not being compatible with VMware’s SCSI driver? Is there a way we can put that driver into the install wim?

on August 12, 2011 at 2:26 pm Reply |

Yep, I wrote a separate post about including third party drivers in the WIM here: VMware should work just the same.

on August 12, 2011 at 2:33 pm Reply |

A required CD/DVD drive device driver is missing. If you have a driver floppy disk, CD, DVD, or USB flash drive, please insert it now.

Note: If the Windows installation media is in the CD/DVD drive, you can safely remove it for this step.

I am also installing into virtual machines.

on August 12, 2011 at 1:50 pm Reply |

I think that even though it’s saying “CD/DVD drive device driver” it’s confused and it means a hard disk storage controller driver. AFAICR the “If the Windows installation media” error is from WinPE so it must be at the stage where it’s loading real device drivers instead of the generic ones where possible. Are you using VirtIO on QEMU-KVM or a VMware SCSI controller that Windows doesn’t have built-in drivers for? Can you switch your hard disks to use something really generic like IDE? (not that you’d have to leave them as IDE, the issue can be fixed, just to check that this is what the issue is)

on August 12, 2011 at 1:58 pm Reply |

I cant figure out why it keeps failing at the cd/dvd driver level. Are there certain drivers I have to have in the image for it to proceed?

on August 12, 2011 at 1:39 pm Reply |

I typically install into virtual machines that don’t have CD drives, but I can’t see why having a drive defined (or installed in a physical server) would cause any problems. What exactly is the error?

on August 12, 2011 at 1:48 pm Reply |

Alright! Getting there. Now I am getting errors that its missing a necessary CD/DVD driver.

on August 12, 2011 at 1:00 pm Reply |

Everything works good now. The BCD file was in the wrong location on my tftp server. Now I get an error regarding an invalid product key. The key is valid, I have used it on all my servers here. I am wondering if its having trouble finding the correct version (DATACENTER) to apply the key to?

This is from my answer file:

Windows Server 2008 R2 SERVERDATACENTER

on August 12, 2011 at 12:35 pm Reply |

The MSDN DVD I was using has all the distributions (server core, datacenter etc.) as separate images on the disk, so I need that <MetaData> to make the installer choose the right one. If you have a normal DVD with a single distribution on it then you can probably delete the whole <MetaData> section to make it work.

on August 12, 2011 at 12:45 pm Reply |

Great tutorial! I have been using pxelinux for a while now, and gave this a try. I get to the Windows Boot Manager and get the following error:

File: BootBCD
Status: 0x000000f
Info: An error occurred while attempting to read the boot configuration data.

/var/log/messages is looking for boot.ini and says that the file is not found.

Any ideas?

on August 11, 2011 at 5:56 pm Reply |

Well it’s trying to get boot.ini because the BCD either wasn’t readable, or was damaged, so once the BCD is fixed that should go away.
It gets the pxeboot.n12 bootloader, so your tftp server is working. I think your BCD must be bad. Try just “bcdedit -store BCD” on your BCD, and compare it to this one:

C:datawinpe_amd64>bcdedit -store BCD

Windows Boot Manager
identifier {bootmgr}
description Windows BootManager
debugtype Serial
debugport 1
baudrate 115200
bootdebug Yes
displayorder {f26e3cc3-40e1-11e0-9683-001c42e9b3e9}
timeout 30

Windows Boot Loader
identifier {f26e3cc3-40e1-11e0-9683-001c42e9b3e9}
device ramdisk=[boot]Bootboot.wim,{ramdiskoptions}
description WinPE Boot Image
locale en-US
osdevice ramdisk=[boot]Bootboot.wim,{ramdiskoptions}
systemroot Windows
detecthal Yes
winpe Yes
sos No
debug No

If you get it working, post back what you did and I’ll update the howto. It might be a copy/paste problem caused by the bad line-wrapping of the blocks.

on August 11, 2011 at 6:45 pm Reply |

I recreaded the BCD 3 times, and this is the what bcedit -store BCD reports:

c:winpe_amd64>bcdedit -store BCD

Windows Boot Manager
identifier {bootmgr}
description Windows Boot Manager
displayorder {a20dd1b1-c44d-11e0-b7cc-0050568f00ac}
timeout 30

Windows Boot Loader
identifier {a20dd1b1-c44d-11e0-b7cc-0050568f00ac}
device ramdisk=[boot]Bootboot.wim,{ramdiskoptions}
description WinPE Boot Image
osdevice ramdisk=[boot]Bootboot.wim,{ramdiskoptions}
systemroot Windows
detecthal Yes
winpe Yes


on August 11, 2011 at 7:16 pm Reply |

This could also be the thing, we need to map to /.

imac:/Users/chrisl/ 7$ tftp bootsrv
tftp> get BootBCD
Received 16418 bytes in 0.1 seconds

Do you download the BCD if you do that same operation? If not the map file might be broken or not loaded.

on August 11, 2011 at 7:45 pm Reply |