Windows Provisioning made Easy!

In our environment with vSphere 6.7 and Microsoft DHCP, legacy(BIOS) provisioning works great with the PXELinux chain load.

I have been trying to get UEFI provisioning working but I’m stumped now. Here are all of the modifications I have made thus far:

  1. When creating the host, select “iPXE Chain UEFI” as the PXE Loader.

  2. The partition table needs to be set to gpt with efi: https://github.com/theforeman/community-templates/blob/develop/partition_tables_templates/windows_default_gpt_efi.erb

  3. In order for iPXE to boot with UEFI, I had to compile an ipxe.efi binary embedded with an iPXE script that points to foreman:

    #!ipxe
    dhcp
    chain http://FOREMAN.KATELLO.URL:8000/unattended/iPXE?mac=${netX/mac} || shell
    exit 0
    

The script will drop into an iPXE shell if the chain command does not work. This script needs to be inbeded into an efi binary so here is what I did:

git clone http://git.ipxe.org/ipxe.git
cd ipxe/src
vim script.ipxe #This contains the ipxe script above
make bin-x86_64-efi/ipxe.efi EMBED=script.ipxe
scp bin-x86_64-efi/ipxe.efi FOREMAN.KATELLO.URL:/var/lib/tftpboot/
#Then on foreman:
restorecon -RvF /var/lib/tftpboot

After copying the new binary to foreman, I create a host and I get all the way to the winpe shell where I am met with the following sad message:

I am stumped now because iPXE seems to grab all of the files but peSetup.cmd is missing in the winpe shell. I added a step in the iPXE template to check all of the files loaded into initrd and they are all present:

I was able to run wget64.exe http://FOREMAN.KATELLO.URL:8000/unattended/script?token=foobar -O peSetup.cmd followed by .\peSetup.cmd which ran through the install process ending with a UEFI bootable windows vm.

If anyone has any ideas on why the setup script is not being copied to the windowspe shell please let me know!