Skip to content

Instantly share code, notes, and snippets.

@DXPetti
Created August 22, 2018 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DXPetti/6f62e7ed9835892fef510f954de69b96 to your computer and use it in GitHub Desktop.
Save DXPetti/6f62e7ed9835892fef510f954de69b96 to your computer and use it in GitHub Desktop.
<#
.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