up vote 0 down vote favorite
share [g+] share [fb]

Sometimes I need to use preferred and alternate DNS server addresses, and sometimes I need Windows to obtain it automatically. The common approach to switch between those addresses is:

  • Right click on Local Area Connection icon on the taskbar notification area
  • Select Status
  • Click on Properties
  • Select Internet Protocol (TCP/IP) and select Properties
  • Switch between Obtain DNS server address automatically and Use the following DNS server addresses.

Since I am switching them frequently, I need a faster and easier way to do this. Any recommendations?

link|improve this question

feedback

3 Answers

up vote 2 down vote accepted

You could use the netsh.exe command-line utility to achieve that. I found this page which provides some examples, including a couple to edit nameservers.

link|improve this answer
feedback

I use Net Profiles for this purpose. You can make predefined network profiles and easily switch between them at any time:

alt text

Features

  • Save your network settings as profiles.
  • Automatically activate wireless profiles when specified wireless connections are detected. (XP only)
  • Change IP Address, Subnet Mask, Default Gateway, Primary and Secondary DNS Servers, WINS Server, and DHCP settings with the click of a button.
  • Specifiy different mapped drives for each profile.
  • Change your default printer based on which profile you're currently using.
  • Automatically change your profile via program shortcuts created with Net Profiles.
  • Change the default homepage for Internet Explorer, Firefox, and Opera.
  • Proxy settings for Internet Explorer, Firefox, and Opera.
  • Run a user-defined list of programs when a profile is activated.
  • Maintain seperate desktop wallper for each profile.
  • Change screen resolutions and color quality when profiles are activated.
  • Can be easily translated into other languages using the enclosed XML language file.

Net Profiles is free and open source.

link|improve this answer
feedback

You could set up a Powershell script to change the DNS settings as shown in this blog:

$strDNSServers = "192.168.1.50", "192.168.1.51","192.168.1.52"

function Update-DNS
{
  $Nic = Get-WMIObject Win32_NetworkAdapter -comp $strComputer |where{$_.NetConnectionID -eq "Local Area Connection"}

  $Config   = Get-WMIObject Win32_NetworkAdapterConfiguration -comp $strComputer |where{$_.MACAddress -eq $Nic.MACAddress}

  write-host "The current DNS Search Order is:"
  $config.DNSServerSearchOrder

  $config.SetDNSServerSearchOrder($strDNSServers) | out-null
}
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.