Skip to content

Unbinilium/Switch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A light PowerShell script for you to change DNS on Windows

Switch Features

  • Set multiple DNS servers directly with concurrent requests enabled
  • Set DNS by Well-Known DNS providers by just entering provider's names
  • Set custom DNS manually by entering its IP addresses and restore to default easily
  • Fully written in PowerShell and no other dependencies required

System Requirements

  • Windows 10 1709 Professional with PowerShell 5.1 Later

Notice

  • Administrator permission required by Set-DnsClientServerAddress
  • Only IPv4 DNS address family supported, using IPv6 or DNS over TLS/HTTPS may cause error
  • Do not input same DNS provider and custom DNS to avoid use one DNS repeatedly
  • Custom DNS IP address must follow the general REGX 0.0.0.0-255.255.255.255
  • Always type completed words for Custom or Default to avoid miss matching
  • TEMP file geneated in ~\AppData\Local\Temp\tmp*.tmp and cleaned up after the operation
  • DNS providers number is limited, enter too many would cause error
  • Using flexible words matching, make sure DNS provider you entered is standalone to avoid cause error
  • Modifying DNS provider also requires each record is standalone

Start

Please Download Switch from the link below directly to your PC and run Switch using PowerShell by Administrator by clicking Run with PowerShell in menu list, follow the notices displayed on the screen.

https://raw.githubusercontent.com/Unbinilium/Switch/master/switch.ps1

Usage

When specializing the DNS provider, you can input mutiple DNS provider's name spilted by space , like the example below:

Google Cloudflare

Also it matches with no case sensitive so it's normally ok to input like the code below, It not always stable, please review Notice.

gOoGle ClOuDflAre
gOoGLe 1.1.
Goog 1.0

You can input Custom as a provider that allows you to set some customized DNS servers, you can only type Custom in DNS providers to use the DNS server only your specialized, or example below means append your custom DNS server to DNS provider Google:

gOoGle Custom

Custom DNS server address should be formatted, when input multiple address they shoud be divided by comma , like this:

9.9.9.9,117.50.22.22

If you want to restore the DNS settings to default or just use the DNS server form DHCP broadcast, you can type Default in DNS providers.

Modifying DNS provider is not recommended, it stored with Base64 encoded with encoding UTF-8 CRLF in the variable named $DNS_List. The decoded Base64 will be like this following the structure #DNS provider's name/"DNS provider's address1","DNS provider's address2":

#114DNS/"114.114.114.114","114.114.115.115"
#Google/"8.8.8.8","8.8.4.4"
#Cloudflare/"1.1.1.1","1.0.0.1"
#Aliyun/"223.5.5.5","223.6.6.6"
#CNNIC/"1.2.4.8","210.2.4.8"
#Baidu/"180.76.76.76"
#Dnspod/"119.29.29.29","182.254.116.116"
#OpenDNS/"208.67.222.222","208.67.220.220"
#Microsoft/"4.2.2.1","4.2.2.2"
#Custom/
#Default/

The opration custom and restore to default are generally defined in the end of this file.

Author & Acknowledge

Switch DNS Modifier Written by Unbinilium using open source project PowerShell.

Releases

No releases published

Packages

No packages published