Share via


Set dhcp optionvalue (dnsserver) ondhcp scope

Question

Monday, June 1, 2020 9:07 AM

Hello all,

Please does somebody can help me? I would like to set the dhcp optionvalue 06 on many dhcp scope. I run two differnents methods scripts below, but it not work...

1st method

$dnsArray = $_.DNS1,$_.DNS2
import-csv "c:\script\DHCPScopeSicra.csv" -Delimiter ";" | % Set-DhcpServerv4OptionValue -servername $_.DHCPServer -ScopeId $_.ScopeID -DnsServer $dnsArray 

2nd method

import-csv "c:\script\DHCPScopeSicra.csv" -Delimiter ";" | % {Set-DhcpServerv4OptionValue -cn ServernameScopeId $_.ScopeId -DnsServer $_.DnsServer.split(',')} 

Thank you very much for your help by advance.

Mohamed

All replies (1)

Tuesday, June 2, 2020 2:58 AM ✅Answered

Hi,

Since you have asked the same question in the powershell forum and an MVP has replied to you to help you modify the scripts, we suggest that you can focus on that thread as experts of powershell will assist you there. 

Set dhcp optionvalue (dnsserver) ondhcp scope by powershell

So that you would get a more satisfying explanation and solution to this issue.
You can mark the replies here as answered to finish this thread. 
Best regards,
Phoebe Wu

Please remember to mark the replies as an answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com