troubleshooting Question

DHCP Scope Change by Name or Exclusion (DNS)

Avatar of Patrick G
Patrick G asked on
DHCPDNSPowershell
9 Comments1 Solution84 ViewsLast Modified:
Hello Experts!

I'll preface this post by saying I am NOT a PowerShell expert by any stretch of the imagination, but I need to get this script done fairly quickly and would greatly appreciate some help.

Our environment has about 6 DHCP scopes at each site (about 125 sites). Each site has a dhcp server.

I need to write a script to change the DNS servers on all the scopes except for one.

All scope names are uniform, but they all have unique ranges.

Instead of having to plug in all the ScopeID variables for every scope using a different command (apparently, I also can't stack multiple ScopeID's in the same command) using the following:

Set-DhcpServerv4OptionValue -ComputerName "srv1234.blah.net" ,-ScopeID, 123.45.6.0, etc -DnsServer 123.456.789.1, etc

Is there a way to simply use scope names? Obviously, simply substituting -ScopeID for -Name isn't valid, since even though it's listed in the output of format-list, it's not a unique variable.

Or use a command like
Set-DhcpServerv4OptionValue -ComputerName "srv1234.blah.net"  -DnsServer 123.456.789.1

But with an exclusion for the scope I don't want?

Thanks!!
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros