Skip to content

Instantly share code, notes, and snippets.

@peteraritchie
Created April 11, 2025 18:30
Show Gist options
  • Save peteraritchie/75ce927ea4e82d6a756e039d36008705 to your computer and use it in GitHub Desktop.
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
$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