using powershell to change dhcp option 6 and 15 for all scopes

I have all my scopes in a text file by their IP address. i can use set-dhcpserverv4optionvalue -computername "name" -scopeid "0.0.0.0" -optionid 6 -value 1.1.1.1

i have about 50 scopes i need to change and i want to point that scope to the text file to read and change all of the setting at once.
Derrell brameAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeremy WeisingerSenior Network Consultant / EngineerCommented:
What's the format of the text file?
0
Derrell brameAuthor Commented:
.txt
0
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Sorry I wasn't clear. What does the data look like in the text file?
0
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Derrell brameAuthor Commented:
1.1.1.1
2.2.2.2
3.3.3.3

And so on
0
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
So if you're setting all scopes to the same DNS servers then this should do it:
$scopes = Get-Content "C:\PathToFile.txt"

foreach ($scope in $scopes){set-dhcpserverv4optionvalue -computername "name" -scopeid $scope -optionid 6 -value 1.1.1.1}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Derrell brameAuthor Commented:
Thanks
0
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Glad to help. :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.