How to set DNS servers using Powershell

I couldn’t connect to a Windows 2012R2 server that was using NLA for RDP connections because the DNS servers were wrong, and it could not contact a domain controller.

I was able to connect remotely and run Powershell so I used the following command to set the DNS servers. After this I could then RDP in.

Replace the “ethernet 2” with your own interface name (run IPCONFIG to get your ethernet address) and also replace the IP addresses with your own IP addresses.

Set-DnsClientServerAddress -Interfacealias “ethernet 2” -ServerAddresses (“192.16.0.13″,”192.16.2.10”)

Leave a Reply

Your email address will not be published. Required fields are marked *