Change DNS server with PowerShell

Another alternative to change a DNS is using the PowerShell terminal. This method is aimed more at experienced users. With just one command, you can configure DNS without having to do many clicks through Windows menus.

To do this, open PowerShell as an administrator, enter "PowerShell" in the browser and right-click to select the option "Windows PowerShell" and then "Run as administrator."

Next, you will need to determine the name (Alias) of the adapter (for example: the network card) through which you are connected to the Internet. To do this, enter the following command in PowerShell:

Get-NetAdapter | select ifDesc, ifAlias, ifIndex, MediaType | fl

Change DNS server address
Finally, the address of an alternative DNS server is entered
In the example, the name of the adapter used is “ Ethernet ”. If the equipment is connected to the Internet with a network cable, as in this example, the following command must be entered:

Set-DnsClientServerAddress -InterfaceAlias ​​"Ethernet" -ServerAddresses "8.8.8.8", "8.8.4.4"

In the "Ethernet" field you must use the name of the corresponding interface.

In case the computer is connected via a wireless connection (Wi-Fi), the following command will be entered:

Set-DnsClientServerAddress -InterfaceAlias ​​Wi-Fi -ServerAddresses "8.8.8.8", "8.8.4.4"

Here, too, “Wi-Fi” should be replaced by the name of the adapter used. 8.8.8.8 and 8.8.4.4 are the public addresses of Google's DNS server. In case another type of DNS server is used, the corresponding fields must be replaced.

Know more: computer science vs computer engineering

Comments

  • No Comment Yet
Please login first for post a comment