"dns suffix for this connection" script problem

Hello,

I have a script that changes the "dns suffix for this connection" setting that is partially working.

Here is what is happening:
If the current value is foobar.com and I set  StrDNSDomain ="newvalue.com" for this command
objItem.SetDNSDomain(StrDNSDomain)

ipconfig /all and the GUI  DNS network properties show newvalue.com.

If I then change StrDNSDomain ="" (clearing out the "dns suffix for this connection" value),
ipconfig /all reverts back foobar.com BUT the GUI DNS is blank.

This will happen regardless of the number of times I set the connection property.  For example I can run the script with a value of foobar1.com, then  foobar2.com,  then foobar3.com and after each pass ipconfig /all and the GUI show the value.  

As soon as I try to clear out the value (which is my goal for this script), the property reverts back to the original setting.  I have tried to reboot the system as well and that has not done anything.    Any ideas?
mcalo1Asked:
Who is Participating?
 
mcalo1Connect With a Mentor Author Commented:
That did not work either.  I think it is a machine specific issue.

Thanks for the suggestions however.
0
 
EshuunDaraCommented:
The DNS Suffix is typically controlled by your domain.  If you're in a domain environment, you should be changing this value using group policy, not a script, which may be the source of your problem.
0
 
EshuunDaraCommented:
Also, if you're using DHCP, your DHCP server can set your DNS suffix.  You might be able to change it there as well.
0
Improved Protection from Phishing Attacks

WatchGuard DNSWatch reduces malware infections by detecting and blocking malicious DNS requests, improving your ability to protect employees from phishing attacks. Learn more about our newest service included in Total Security Suite today!

 
EshuunDaraCommented:
Finally, you can also edit the registry.  Your DNS info is stored here:

HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Paramaters

And you'll want to change these entries:
Domain (REG_SZ)
SearchList (REG_SZ)

0
 
mcalo1Author Commented:
I am looking to change  the specific network connection  dns suffix, not the machine one.  There are some domain and non domain machines that need this setting, so a GPO will not cover all the machines.

The script does work in changing the suffix for network connections, but just not when it is blank. This is what I need to get working.  

0
 
RobSampsonCommented:
Hi, have you tried
objItem.SetDNSDomain(Null)

Or
objItem.SetDNSDomain(vbNullString)

Rob.
0
 
mcalo1Author Commented:
The issue resided on some of the target machines.
0
 
RobSampsonCommented:
What *was* the issue?  Did you reimage the machines?

Rob.
0
 
mcalo1Author Commented:
We reimaged a couple of machines and it worked on them.  I am guessing it was something to do with specific hot fixes/applications/etc on the machine.  The most cost effective thing to do was to cut bait and have our intern manually change the settings on the problematic machines.

Thanks
0
 
RobSampsonCommented:
Fair enough. Thanks for the info.

Rob.
0
 
mcalo1Author Commented:
Closing this.
0
 
mcalo1Author Commented:
It was a machine specific issue
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.

All Courses

From novice to tech pro — start learning today.