Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<#
.DESCRIPTION
Powershell script to remove DHCP policies that allows Legacy BIOS based network booting (PXE) based upon information sent by client detailed in RFC 4578 (https://tools.ietf.org/html/rfc4578)
.PARAMETERS
None - execute directly from Powershell
.VERSION
1.0
.AUTHOR
James Pettigrove
.COMPATIBILITY
Windows 7, Windows 10
.RELEASE DATE
06/04/2017
.NOTES
v1.0, 20170401 - Initial Version
#>
$dhcpServers = Get-DhcpServerInDC
$className = "PXEClient(Legacy BIOS)"
$policyName = "Legacy BIOS"
[array]$dhcpScopes = (Read-Host "Enter DHCP Scopes (separate with comma) to remove Legacy BIOS boot option").split(",") | %{$_.trim()}
foreach ($dhcpServer in $dhcpServers) {
foreach ($dhcpScope in $dhcpScopes) {
Write-Host -ForegroundColor Yellow "Removing $policyName from $dhcpScope"
Remove-DhcpServerv4Policy -ComputerName $dhcpServer -ScopeId $dhcpScope -Name $policyName
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment