Skip to content

Instantly share code, notes, and snippets.

@adrianriobo
Last active December 9, 2020 08:53
Show Gist options
  • Save adrianriobo/8776b8642b968574a03dcb757533dd34 to your computer and use it in GitHub Desktop.
Save adrianriobo/8776b8642b968574a03dcb757533dd34 to your computer and use it in GitHub Desktop.
Powershell for DNS
# Check rules
Get-DnsClientNrptRule
#Set metric to manage interface precedence order
Set-NetIPInterface -InterfaceIndex 17 -InterfaceMetric 15
# Check / Set DNS address
Get-DnsClientServerAddress
Set-DnsClientServerAddress -InterfaceIndex 17 -ServerAddresses ("172.17.167.38")
Set-DnsClientServerAddress -InterfaceIndex 17 -ResetServerAddresses
# Manage DnsClientNrptRule
Get-DnsClientNrptRule | ? {$_.namespace -like '*.testing'} | Remove-DnsClientNrptRule -Force
Add-DnsClientNrptRule -Namespace ".subdomain.domain" -NameServers "192.168.185.201"
Add-DnsClientNrptRule -Namespace ".subdomain2.domain" -NameServers "192.168.185.201"
# Flush DNS
ipconfig /flushdns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment