<commit_before>---
layout: post
title: "Deploying ESXi via Windows Deployment Services: UEFI Edition" 
excerpt: "It is unified and extensible apparently"
tags: 
- Pro-Tip
- VMware
- Deployment
- Windows
image:
  thumb: /esxi-wds-uefi/esxi-wds-uefi-00.png
comments: true
date: 2020-12-29T00:00:00+00:00
---
<img style="float: right; margin: 0px 0px 10px 10px;" alt="vSphere Logo" src="/images/esxi-wds-uefi/esxi-wds-uefi-00.png">
Just over five years ago (yep... time flies!) <br>I posted a simple method to boot and install a VMware ESXi server from a Microsoft Windows Deployment Services (WDS) Server. <br>Back then I was using Windows Server 2012 to boot ESXi 5.5.  Check out that post [here](https://polarclouds.co.uk/deploying-vmware-esxi-via-wds/).

Prompted by a recent [comment from Tariq](http://disq.us/p/2dcu804) on that post:
> The procedure works fine when BIOS set to Legacy mode. But, it is not working when set to UEFI mode.

Got me thinking.  Let's update that post.  

Not only will we go for UEFI booting, lets use WDS from Windows Server 2019 and ESXi 7.0 too.  What follows is a whistle stop process to go from zero to 
booting ESXi via UEFI from WDS.

{% include _toc.html %}
## What, Why, When?
### What?
-  **UEFI**: Unified Extensible Firmware Interface: Replaces the legacy Basic Input/Output System (BIOS) firmware interface originally present in all IBM PC-compatible PCs/Servers. [Learn more about UEFI here](https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface).
- **WDS**: Windows Deployment Services is a server technology from Microsoft for network-based installation of Windows operating systems - although we are going to leverage our WDS server for ESXi. [Learn more about WDS here](https://docs.microsoft.com/en-us/windows/deployment/windows-deployment-scenarios-and-tools#windows-deployment-services)
- **ESXi**: A bare-metal hypervisor that is capable of running Virtual Machines.  [Learn more about ESXi here](https://www.vmware.com/uk/products/esxi-and-esx.html)

### Why?
ESXi is shipped by VMware in the form of an ISO disk image file.  To install ESXi, the administrator either has to create a USB device (stick, hard disk, etc) from the image or burn the image onto a CD-ROM or finally use some other third party method (HP iLO, Dell iDRAC, IBM RSA) to boot the ESXi installer in order to install ESXi.

Instead of all that, how about just extracting the ESXi ISO file to a folder, updating two files and booting the server to have ESXi installed over the network? Much quicker and simpler!

### When?
Typically and to get the most of of the VMware portfolio of products, ESXi is not installed on just one server per datacentre or solution. Clustered ESXi deployments can number from two to thirty two ESXi hosts per cluster, per solution.

Imagine having to deploy thirty two ESXi hosts from a handful of boot CD's or USB sticks...

What's more, using VMware Workstation / VMware Workstation Player, you *could* install your WDS server into a VM and use that VM to boot and deploy ESXi.  

## Install WDS and DHCP Services
First off, grab a copy of Windows Server 2019.  If you don't already have a copy, you can download a 180 day trial [from here](https://www.microsoft.com/en-gb/windows-server/trial).

I'm not going to cover deploying Windows Server, it's simple enough and there are plenty of other sites that cover that ([for example](https://computingforgeeks.com/install-windows-server-2019/)).  Once installed, make a note of the IP address you assign to the WDS server. You'll need that later.  For example, I gave my WDS server an IP address of 192.168.123.2. Yours maybe different.

Once you Windows server has been installed, open **Server Manager** and select **Add Roles and Features**.  From there click **Next** two or three times (depending on your server configuration and tick the following roles to be installed. Click **Add Features** when prompted to add role features:

- DHCP Server
- Windows Deployment Services

As shown below:

<img style="display: block; margin-left: auto; margin-right: auto;" alt="Install WDS Roles" src="/images/esxi-wds-uefi/esxi-wds-uefi-01.png">

Click **Next** four times, ensure both **Deployment Server** and **Transport Server** are selected, click **Next** again and finally click **Install**.

Once complete, click on the orange triangle and select **Complete DHCP Configuration**:

<img style="display: block; margin-left: auto; margin-right: auto;" alt="Post Deployment DHCP Config" src="/images/esxi-wds-uefi/esxi-wds-uefi-02.png">

Click **Commit** and **Close** to complete the DHCP server post install configuration.

Lets go ahead and reboot the server at this point.

## Configure WDS and DHCP Services
Now that we have DHCP and WDS installed, it's time to configure both of them.

### DHCP Service
Click **Start, Windows Administrative Tools, DHCP**, right click **IPv4** and select **New Scope**.

Name the scope (I called mine ESXi Deployment), click **Next** and define your DHCP scope.  Remember to use IP addresses in the same range as your WDS server (As above, I chose to give my WDS server an IP address of 192.168.123.2, so I'll use 192.168.123.10 as my start IP address and 192.168.123.250 as my end IP address - again, yours maybe different).

Click **Next**, set any scope exclusions (if required), **Next**, set the DHCP lease duration (again, if required), click **Next**, click **Yes I want to configure these options now** and **Next**.  Set your gateway IP (I'm using 192.168.123.1), click **Add** and **Next**.  

Configure your DNS settings if required (I'm not using any DNS in my deployment as the ESXi installer has no need for DNS, so I left everything blank) and clicked **Next**. 

I cant remember when anyone last used WINS, so click **Next**.

Finally, click **Yes I want to activate this scope now**, **Next** and **Finish**

My completed DHCP scope looked like this:

<img style="display: block; margin-left: auto; margin-right: auto;" alt="DHCP Scope" src="/images/esxi-wds-uefi/esxi-wds-uefi-03.png">

### WDS Service
Click **Start, Windows Administrative Tools, Windows Deployment Services**. Open up Servers right click your server and select **Configure Server**.

Click **Next**, **Standalone Server**, set path to **C:\RemoteInstall**, click **Next** and **Yes** to continue if you receive a warning. 

Ensure that only **Do not listen on DHCP and DHCPv6 ports** is ticked. If needed, untick **Configure DHCP options for Proxy DHCP** and click **Next**

Ensure that **Do not respond to any client computers** is selected, click **Next** and **Finish**.  Ignore the error regarding unable to start WDS services in a timely fashion should you receive it. 

Next we need to add two entries into the registry to allow WDS to support deploying ESXi. 

Open regedit and navigate to the following key:
{% highlight text %}
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WDSServer\Providers\WDSTFTP
{% endhighlight %}
Double click **ReadFilter** and add the following to the bottom of the list and click **OK**:
{% highlight text %}
/boot/*
boot/*
{% endhighlight %}
If you receive an error regarding empty strings, just click **OK**.  Your saved entry should look like this:

<img style="display: block; margin-left: auto; margin-right: auto;" alt="WDSTFTP Registry" src="/images/esxi-wds-uefi/esxi-wds-uefi-14.png">

Exit regedit, back in the WDS management window opened earlier, right click your WDS server select **All Tasks** and **Start** (or **Restart** if services are already running).  Ensure that the WDS server has a green play button as shown below:

<img style="display: block; margin-left: auto; margin-right: auto;" alt="WDS Configured" src="/images/esxi-wds-uefi/esxi-wds-uefi-04.png">

## ESXi on WDS
Extract the ESXi ISO image to a folder under the **C:\RemoteInstall\Boot** folder.  I'm going to deploy ESXi 7.0 Update 1, so I'll put my ESXi files in **C:\RemoteInstall\Boot\ESXi-7.0.1**, keeping the folder structure from the ISO image:

<img style="display: block; margin-left: auto; margin-right: auto;" alt="ESXi Copied" src="/images/esxi-wds-uefi/esxi-wds-uefi-05.png">

Next, copy the file **C:\RemoteInstall\Boot\ESXi-7.0.1\EFI\BOOT\BOOTX64.EFI** to **C:\RemoteInstall\Boot\ESXi-7.0.1** and rename the file to **moboot.efi**:

<img style="display: block; margin-left: auto; margin-right: auto;" alt="mboot.efi" src="/images/esxi-wds-uefi/esxi-wds-uefi-06.png">

Next we need to update the **boot.cfg** file in **C:\RemoteInstall\Images\ESXi-7.0.1** folder.  There are three changes we need to make:
<style>
table, th, td {
  border: 1px solid black;
  border-collapse: collapse;
}
</style>
<table>
<tr>
<td style="height:5%;  width:33%;">
<b>Original Config</b>
</td>
<td style="height:5%;  width:33%;">
<b>Modified Config</b>
</td>
<td style="height:5%;  width:33%;">
<b>Changes Made</b>
</td>
</tr>
<tr>
<td style="height:5%;  width:33%;"><commit_msg>New Post: Deploying ESXi via Windows Deployment Services: UEFI Edition - Typo Fix<commit_after>---
layout: post
title: "Deploying ESXi via Windows Deployment Services: UEFI Edition" 
excerpt: "It is unified and extensible apparently"
tags: 
- Pro-Tip
- VMware
- Deployment
- Windows
image:
  thumb: /esxi-wds-uefi/esxi-wds-uefi-00.png
comments: true
date: 2020-12-29T00:00:00+00:00
---
<img style="float: right; margin: 0px 0px 10px 10px;" alt="vSphere Logo" src="/images/esxi-wds-uefi/esxi-wds-uefi-00.png">
Just over five years ago (yep... time flies!) <br>I posted a simple method to boot and install a VMware ESXi server from a Microsoft Windows Deployment Services (WDS) Server. <br>Back then I was using Windows Server 2012 to boot ESXi 5.5.  Check out that post [here](https://polarclouds.co.uk/deploying-vmware-esxi-via-wds/).

Prompted by a recent [comment from Tariq](http://disq.us/p/2dcu804) on that post:
> The procedure works fine when BIOS set to Legacy mode. But, it is not working when set to UEFI mode.

Got me thinking.  Let's update that post.  

Not only will we go for UEFI booting, lets use WDS from Windows Server 2019 and ESXi 7.0 too.  What follows is a whistle stop process to go from zero to 
booting ESXi via UEFI from WDS.

{% include _toc.html %}
## What, Why, When?
### What?
-  **UEFI**: Unified Extensible Firmware Interface: Replaces the legacy Basic Input/Output System (BIOS) firmware interface originally present in all IBM PC-compatible PCs/Servers. [Learn more about UEFI here](https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface).
- **WDS**: Windows Deployment Services is a server technology from Microsoft for network-based installation of Windows operating systems - although we are going to leverage our WDS server for ESXi. [Learn more about WDS here](https://docs.microsoft.com/en-us/windows/deployment/windows-deployment-scenarios-and-tools#windows-deployment-services)
- **ESXi**: A bare-metal hypervisor that is capable of running Virtual Machines.  [Learn more about ESXi here](https://www.vmware.com/uk/products/esxi-and-esx.html)

### Why?
ESXi is shipped by VMware in the form of an ISO disk image file.  To install ESXi, the administrator either has to create a USB device (stick, hard disk, etc) from the image or burn the image onto a CD-ROM or finally use some other third party method (HP iLO, Dell iDRAC, IBM RSA) to boot the ESXi installer in order to install ESXi.

Instead of all that, how about just extracting the ESXi ISO file to a folder, updating two files and booting the server to have ESXi installed over the network? Much quicker and simpler!

### When?
Typically and to get the most of of the VMware portfolio of products, ESXi is not installed on just one server per datacentre or solution. Clustered ESXi deployments can number from two to thirty two ESXi hosts per cluster, per solution.

Imagine having to deploy thirty two ESXi hosts from a handful of boot CD's or USB sticks...

What's more, using VMware Workstation / VMware Workstation Player, you *could* install your WDS server into a VM and use that VM to boot and deploy ESXi.  

## Install WDS and DHCP Services
First off, grab a copy of Windows Server 2019.  If you don't already have a copy, you can download a 180 day trial [from here](https://www.microsoft.com/en-gb/windows-server/trial).

I'm not going to cover deploying Windows Server, it's simple enough and there are plenty of other sites that cover that ([for example](https://computingforgeeks.com/install-windows-server-2019/)).  Once installed, make a note of the IP address you assign to the WDS server. You'll need that later.  For example, I gave my WDS server an IP address of 192.168.123.2. Yours maybe different.

Once you Windows server has been installed, open **Server Manager** and select **Add Roles and Features**.  From there click **Next** two or three times (depending on your server configuration and tick the following roles to be installed. Click **Add Features** when prompted to add role features:

- DHCP Server
- Windows Deployment Services

As shown below:

<img style="display: block; margin-left: auto; margin-right: auto;" alt="Install WDS Roles" src="/images/esxi-wds-uefi/esxi-wds-uefi-01.png">

Click **Next** four times, ensure both **Deployment Server** and **Transport Server** are selected, click **Next** again and finally click **Install**.

Once complete, click on the orange triangle and select **Complete DHCP Configuration**:

<img style="display: block; margin-left: auto; margin-right: auto;" alt="Post Deployment DHCP Config" src="/images/esxi-wds-uefi/esxi-wds-uefi-02.png">

Click **Commit** and **Close** to complete the DHCP server post install configuration.

Lets go ahead and reboot the server at this point.

## Configure WDS and DHCP Services
Now that we have DHCP and WDS installed, it's time to configure both of them.

### DHCP Service
Click **Start, Windows Administrative Tools, DHCP**, right click **IPv4** and select **New Scope**.

Name the scope (I called mine ESXi Deployment), click **Next** and define your DHCP scope.  Remember to use IP addresses in the same range as your WDS server (As above, I chose to give my WDS server an IP address of 192.168.123.2, so I'll use 192.168.123.10 as my start IP address and 192.168.123.250 as my end IP address - again, yours maybe different).

Click **Next**, set any scope exclusions (if required), **Next**, set the DHCP lease duration (again, if required), click **Next**, click **Yes I want to configure these options now** and **Next**.  Set your gateway IP (I'm using 192.168.123.1), click **Add** and **Next**.  

Configure your DNS settings if required (I'm not using any DNS in my deployment as the ESXi installer has no need for DNS, so I left everything blank) and clicked **Next**. 

I cant remember when anyone last used WINS, so click **Next**.

Finally, click **Yes I want to activate this scope now**, **Next** and **Finish**

My completed DHCP scope looked like this:

<img style="display: block; margin-left: auto; margin-right: auto;" alt="DHCP Scope" src="/images/esxi-wds-uefi/esxi-wds-uefi-03.png">

### WDS Service
Click **Start, Windows Administrative Tools, Windows Deployment Services**. Open up Servers right click your server and select **Configure Server**.

Click **Next**, **Standalone Server**, set path to **C:\RemoteInstall**, click **Next** and **Yes** to continue if you receive a warning. 

Ensure that only **Do not listen on DHCP and DHCPv6 ports** is ticked. If needed, untick **Configure DHCP options for Proxy DHCP** and click **Next**

Ensure that **Do not respond to any client computers** is selected, click **Next** and **Finish**.  Ignore the error regarding unable to start WDS services in a timely fashion should you receive it. 

Next we need to add two entries into the registry to allow WDS to support deploying ESXi. 

Open regedit and navigate to the following key:
{% highlight text %}
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WDSServer\Providers\WDSTFTP
{% endhighlight %}
Double click **ReadFilter** and add the following to the bottom of the list and click **OK**:
{% highlight text %}
/boot/*
boot/*
{% endhighlight %}
If you receive an error regarding empty strings, just click **OK**.  Your saved entry should look like this:

<img style="display: block; margin-left: auto; margin-right: auto;" alt="WDSTFTP Registry" src="/images/esxi-wds-uefi/esxi-wds-uefi-14.png">

Exit regedit, back in the WDS management window opened earlier, right click your WDS server select **All Tasks** and **Start** (or **Restart** if services are already running).  Ensure that the WDS server has a green play button as shown below:

<img style="display: block; margin-left: auto; margin-right: auto;" alt="WDS Configured" src="/images/esxi-wds-uefi/esxi-wds-uefi-04.png">

## ESXi on WDS
Extract the ESXi ISO image to a folder under the **C:\RemoteInstall\Boot** folder.  I'm going to deploy ESXi 7.0 Update 1, so I'll put my ESXi files in **C:\RemoteInstall\Boot\ESXi-7.0.1**, keeping the folder structure from the ISO image:

<img style="display: block; margin-left: auto; margin-right: auto;" alt="ESXi Copied" src="/images/esxi-wds-uefi/esxi-wds-uefi-05.png">

Next, copy the file **C:\RemoteInstall\Boot\ESXi-7.0.1\EFI\BOOT\BOOTX64.EFI** to **C:\RemoteInstall\Boot\ESXi-7.0.1** and rename the file to **mboot.efi**:

<img style="display: block; margin-left: auto; margin-right: auto;" alt="mboot.efi" src="/images/esxi-wds-uefi/esxi-wds-uefi-06.png">

Next we need to update the **boot.cfg** file in **C:\RemoteInstall\Images\ESXi-7.0.1** folder.  There are three changes we need to make:
<style>
table, th, td {
  border: 1px solid black;
  border-collapse: collapse;
}
</style>
<table>
<tr>
<td style="height:5%;  width:33%;">
<b>Original Config</b>
</td>
<td style="height:5%;  width:33%;">
<b>Modified Config</b>
</td>
<td style="height:5%;  width:33%;">
<b>Changes Made</b>
</td>
</tr>
<tr>
<td style="height:5%;  width:33%;">
{'fraction_non_alphanumeric': 0.11012087116359383, 'fraction_numerical': 0.017155907090736923, 'mean_word_length': 4.4771201952410005, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 63, 'https://': 12, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 10, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '503215', 'n_tokens_mistral': 5745, 'n_tokens_neox': 5305, 'n_words': 2420}