none
Script to Change DNS Client Settings ? RRS feed

  • Question

  • We've added a new DNS server to our environment.

    I've been tasked with adding it to the client DNS settings on all our systems.

    We use Static IP's. No DHCP.

    Some of the systems have multiple Network cards and the OS's are Win 7, 10 and Server 2008, 2012.

    I've experimented with a few scripts, but none were able to handle the issue of multiple NICS.

    How best to accomplish this?

    • Moved by Bill_Stewart Wednesday, May 30, 2018 7:58 PM This question is the reason DHCP exists
    Tuesday, April 10, 2018 2:03 PM

All replies

  • Enumerate the adapters on the system and adjust the DNS.  The DNS will be specific tot he attached network so you will need to detect the correct network for the adapter.

    You can use WMI Win32_NetworkAdapterConfiguration with Where-Object filter that looks at the addresses for the network you wish to update.


    \_(ツ)_/

    Tuesday, April 10, 2018 2:54 PM
  • Why not use DHCP?

    -- Bill Stewart [Bill_Stewart]

    Tuesday, April 10, 2018 3:56 PM