DHCP - DNS Options - Mass Change

 

Powershell handy script for altering it's DNS Servers in one Go for all of your scopes.


# If not installed yet: Install-WindowsFeature -IncludeManagementTools DHCP

$DHCPServers = Get-DhcpServerInDC


foreach ($computername in $DHCPServers) {


$scopes = Get-DHCPServerv4Scope -ComputerName $computername.DnsName |


Select-Object "Name","SubnetMask","StartRange","EndRange","ScopeID","State"

ForEach ($scope in $scopes) {

Set-DhcpServerv4OptionValue -ScopeId "$scope.ScopeID" -DnsServer 10.0.50.1,10.0.50.2