Created
April 11, 2025 18:30
-
-
Save peteraritchie/75ce927ea4e82d6a756e039d36008705 to your computer and use it in GitHub Desktop.
Set all connected physical network adapters to use google DNS in Admin PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$nics = (get-netadapter -Physical | where Status -EQ -Value 'Up') | |
#(get-netadapter -Physical | ? Status -EQ -Value 'Up') | % { Write-Host $_.InterfaceDescription; }; | |
#(get-netadapter -Physical | ? Status -EQ -Value 'Up') | % { Set-DNSClientServerAddress –interfaceIndex $_.ifIndex –ServerAddresses ("8.8.8.8", "8.8.4.4"); }; | |
foreach($nic in $nics) | |
{ | |
Write-Host "Setting $($nic.InterfaceDescription) DNS to 8.8.8.8, 8.8.4.4"; | |
Set-DNSClientServerAddress –interfaceIndex $nic.ifIndex –ServerAddresses ("8.8.8.8", "8.8.4.4"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment