Set the DNS server addresses on an interface with a specified index value
Set-DnsClientServerAddress -InterfaceIndex 12 -ServerAddresses ("10.0.0.1","10.0.0.2")
Set Automatic DNS Registration:
Get-NetIPConfiguration |
Get-NetConnectionProfile |
Where IPv4Connectivity -ne "NoTraffic" |
Set-DnsClient -RegisterThisConnectionsAddress:$false -Verbose
The above where filter can also be avoided like this:
Get-NetConnectionProfile -IPv4Connectivity Internet,Disconnected,LocalNetwork,Subnet -ErrorAction SilentlyContinue | Set-DnsClient -RegisterThisConnectionsAddress:$false -Verbose
You can add -UseSuffixWhenRegistering to the Set-DNSClient command to add reverse DNS