• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2366
  • Last Modified:

netsh DHCP error: Server x.x.x.x is not a valid DNS Server when setting VIP as DNS server on a DHCP scope

We are using a Netscaler to load balance our DNS servers internally. This is a new change, so I am trying to update our DHCP scopes with the new IP addresses. We have over 200 scopes, so to do this I want to use netsh.

We are running in a Windows 2008R2 enviroment

The problem I am having is that it wants to verify the DNS server address first, and fails because it cannot due the fact that the IP is a Netscaler.

The VIP itself does work. We have tested by both setting our adapters manually, and manually configuring one of our test scopes. When you manually configure the DNS option on a DHCP scope you also get an error. But it allows you to continue with the change.

Is there a switch that I can use to prevent verification when using netsh?
do I need to create some type of DNS record for the VIP?

Here is the code i am using with the error.

for /f "tokens=1" %%a in (C:\script\cgy.txt) DO netsh DHCP server scope %%a set optionvalue 006 ipaddress

Changed the current scope context to scope.
Server is not a valid DNS Server.

Server is not a valid DNS Server.

Thanks everyone
  • 3
1 Solution
Premkumar YogeswaranAnalyst II - System AdministratorCommented:

The command you using is seems to be perfect..

Can you check by changing the case of IP Address

for /f "tokens=1" %%a in (C:\script\cgy.txt) DO netsh DHCP server scope %%a set optionvalue 006 IPADDRESS

Also try the command directly without script

netsh DHCP server scope set optionvalue 006 IPADDRESS

Good luck..

ssiimmpplleeAuthor Commented:
Thanks premglitz,

But that dose not seem to help. I did find a switch "/DHCPFullForce" for netsh that is supposed to be used for setting option 006 when the DNS server is not available. But it does not seem to help either.

netsh DHCP server scope set optionvalue 006 IPADDRESS /DhcpFullForce

DHCP Server Scope Set OptionValue failed.

Parameter(s) passed are either incomplete or invalid.
ssiimmpplleeAuthor Commented:
I found a way to do this using powershell. I downloaded the DHCP power shell module for this. I was able to use a csv file to change mutiple scopes at the same time.

Using a CSV file to feed the code

example of csv


Open in new window

power shell code

Import-Csv C:\downloads\dhcpscopelist.csv | foreach {
  	$scope="{0}/{1}" -f $_.dhcpserver,$_.scope
	Set-DHCPOption -Owner $scope -OptionID 006 -DataType IPADDRESS -Value "" -Force

Open in new window

ssiimmpplleeAuthor Commented:
I resolved this myself.
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

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