PowerShell Script Settings DNS

Source: Internet
Author: User

#!powershell$adapter = Get-netadapter |? {$_. Interfacedescription-ne "Microsoft km-test Loopback Adapter"}if ($adapter-ne $null) {$adapter |  Rename-netadapter-newname "ETH" Disable-netadapterbinding-name "eth"-componentid ms_tcpip6 netsh interface ipv4 Set DNS Name= "ETH" source=static address=114.114.114.114 primary netsh interface ipv4 add dnsserver name= "ETH" addres s=8.8.8.8 index=2 netsh interface ipv4 add dnsserver name= "Eth" address=202.96.209.133 index=3}

These are the scripts for PowerShell to set the DNS address for PowerShell 4 and later


WINDWOS 2008 Changing the DNS method:

$WMI =get-wmiobject-class win32_networkadapterconfiguration-filter ipenabled=true-computername computer name $WMI. SetDNSServerSearchOrder (' 8.8.8.8 ')



This article is from the "Zengestudy" blog, make sure to keep this source http://zengestudy.blog.51cto.com/1702365/1928929

PowerShell Script Settings DNS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.