• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 69
  • Last Modified:

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.
0
Derrell brame
Asked:
Derrell brame
  • 4
  • 3
1 Solution
 
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
Worried about phishing attacks?

90% of attacks start with a phish. It’s critical that IT admins and MSSPs have the right security in place to protect their end users from these phishing attacks. Check out our latest feature brief for tips and tricks to keep your employees off a hackers line!

 
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
 
Derrell brameAuthor Commented:
Thanks
0
 
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Glad to help. :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now