I am trying to set two IP addresses for option 6 DNS server using this code:
$serverIpAddress = '11.12.13.14'
$subnet = '11.12.43.33'
$value = '11.12.74.21,11.12.74.22'
netsh dhcp Server $serverIpAddress Scope $subnet set optionvalue 6 IPADDRESS "$value"
But am getting this error:
DHCP Server Scope Set OptionValue failed.
Parameter(s) passed are either incomplete or invalid.
How can I fix this?
EDIT: Turns out I can get it to work by using two separate variables:
$serverIpAddress = '11.12.13.14'
$subnet = '11.12.43.33'
$value1 = '11.12.74.21'
$value2 = '11.12.74.22'
netsh dhcp Server $serverIpAddress Scope $subnet set optionvalue 6 IPADDRESS $value1 $value2
How can I make it work with one variable?