Thought I might share this for others who are using DHCP via Windows Server OS (2016+). The following script is what I’ve been using to quickly add all the entries and whatnot to have legacy and UEFI PXE options. Just copy/paste the code below and run it on the Windows server in question. It will ask for the DHCP server name (FQDN preferred), IP address of the scope you wish to modify and the IP address of the FOG server. May need to run it as admin and enable scripts on the OS.
#Add-WindowsFeature -Name DHCP –IncludeManagementTools
Import-Module DhcpServer
cls
"
This script will add new vendor classes, policies and options
66/67 for Legacy & UEFI PXE booting. Please double check what
you enter in the prompts or you will need to rerun the script.
This script will also update/replace entries that already
exist so you can use it to change the IP of the FOG server.
"
$Server = Read-Host -Prompt 'Enter the FULL name of the DHCP server (FQDN)'
$Scope = Read-Host -Prompt 'Enter the network scope IP address (DHCP server has the scope IP listed)'
$WDSvr = Read-Host -Prompt 'Enter the IP of the FOG server'
$VendorClassUEFIx64 = @{
Name = "PXEClient UEFI (x64)"
Description = "PXEClient UEFI (x64)"
Type = "Vendor"
Data = "PXEClient:Arch:00007"
}
$VendorClassUEFIx64_2 = @{
Name = "PXEClient UEFI (x64)_2"
Description = "PXEClient UEFI (x64)_2"
Type = "Vendor"
Data = "PXEClient:Arch:00008"
}
$VendorClassUEFIx64_3 = @{
Name = "PXEClient UEFI (x64)_3"
Description = "PXEClient UEFI (x64)_3"
Type = "Vendor"
Data = "PXEClient:Arch:00009"
}
$VendorClassUEFIx86 = @{
Name = "PXEClient UEFI (x86)"
Description = "PXEClient UEFI (x86)"
Type = "Vendor"
Data = "PXEClient:Arch:00002"
}
$VendorClassUEFIx86_2 = @{
Name = "PXEClient UEFI (x86)_2"
Description = "PXEClient UEFI (x86)_2"
Type = "Vendor"
Data = "PXEClient:Arch:00006"
}
$VendorClassBIOS = @{
Name = "PXEClient BIOS (x86 & x64)"
Description = "PXEClient BIOS (x86 & x64)"
Type = "Vendor"
Data = "PXEClient:Arch:00000"
}
Add-DhcpServerv4Class @VendorClassUEFIx64 -ComputerName $Server
Add-DhcpServerv4Class @VendorClassUEFIx64_2 -ComputerName $Server
Add-DhcpServerv4Class @VendorClassUEFIx64_3 -ComputerName $Server
Add-DhcpServerv4Class @VendorClassUEFIx86 -ComputerName $Server
Add-DhcpServerv4Class @VendorClassUEFIx86_2 -ComputerName $Server
Add-DhcpServerv4Class @VendorClassBIOS -ComputerName $Server
Add-DhcpServerv4Policy -Name "PXEClient UEFI (x64)" -ScopeId $Scope -Condition OR -VendorClass EQ,"PXEClient UEFI (x64)*"
Add-DhcpServerv4Policy -Name "PXEClient UEFI (x86)" -ScopeId $Scope -Condition OR -VendorClass EQ,"PXEClient UEFI (x86)*"
Add-DhcpServerv4Policy -Name "PXEClient BIOS" -ScopeId $Scope -Condition OR -VendorClass EQ,"PXEClient BIOS (x86 & x64)*"
Set-DhcpServerv4OptionValue -OptionId 66 -Value $WDSvr -ComputerName $Server -ScopeId $Scope
Set-DhcpServerv4OptionValue -OptionId 67 -Value "undionly.kpxe" -ComputerName $Server -ScopeId $Scope
Set-DhcpServerv4OptionValue -OptionId 66 -Value $WDSvr -ComputerName $Server -ScopeId $Scope -PolicyName "PXEClient BIOS"
Set-DhcpServerv4OptionValue -OptionId 67 -Value "undionly.kpxe" -ComputerName $Server -ScopeId $Scope -PolicyName "PXEClient BIOS"
Set-DhcpServerv4OptionValue -OptionId 66 -Value $WDSvr -ComputerName $Server -ScopeId $Scope -PolicyName "PXEClient UEFI (x64)"
Set-DhcpServerv4OptionValue -OptionId 67 -Value "ipxe.efi" -ComputerName $Server -ScopeId $Scope -PolicyName "PXEClient UEFI (x64)"
Set-DhcpServerv4OptionValue -OptionId 66 -Value $WDSvr -ComputerName $Server -ScopeId $Scope -PolicyName "PXEClient UEFI (x86)"
Set-DhcpServerv4OptionValue -OptionId 67 -Value "i386-efi/ipxe.efi" -ComputerName $Server -ScopeId $Scope -PolicyName "PXEClient UEFI (x86)"