none
DNS round robin RRS feed

  • Question

  • i've set round robin in dns for 3 servers. for example 1.1.1.1,2.2.2.2,3.3.3.3

    i want to run a command with script that will check if 1.1.1.1 server fails in ping test, then  the command should be able to change the order of dns query response. so now 2.2.2.2 should be shown first in dns query response.

    Tuesday, January 2, 2018 3:54 PM

All replies

  • Hi,

    Please refer to the following script:

     $dnsServers = '1.1.1.1','2.2.2.2','3.3.3.3' #we could use FQDN replace IP address here
    
    foreach($dns in $dnsServers)
    {
        if(Test-Connection -ComputerName $dns -ErrorAction SilentlyContinue)
        {
            Set-DnsClientServerAddress -InterfaceIndex 4 -ServerAddresses $dns
        }else{
            Write-Host "Current DNS server can't ping!"+$dns
        }
    }  

    In addition, If the above script doesn't help ,please have this asked in Powershell Forum for better answers:

    https://social.technet.microsoft.com/Forums/windows/en-US/home?forum=winserverpowershell

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.Thank you for your understanding.

    Also , the forum is for scripting questions rather than script requests. The purpose of Powershell forum is to get answers to scripting questions rather than to ask others to write or rewrite scripts.

    This forum is for scripting questions rather than script requests

    Best Regards,

    Candy


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

    Wednesday, January 3, 2018 2:34 AM
  • Hi ,

    Just checking in to see if the information provided was helpful.

    Please let us know if you would like further assistance.

    Best Regards,

    Candy


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

    Thursday, January 4, 2018 7:14 AM
  • Hi ,

    Was your issue resolved?

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

    If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.

    If no, please reply and tell us the current situation in order to provide further help.

    Best Regards,

    Candy


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

    Monday, January 8, 2018 2:27 AM