3 ms·
Comparable PowerShell Resolve-DnsName commands, though it's not overall as capable: Basic lookup against specific DNS server: # dig @8.8.8.8 jvns.ca
by jodrellblank 5y ago
Comparable PowerShell Resolve-DnsName commands, though it's not overall as capable:
Basic lookup against specific DNS server:
# dig @8.8.8.8 jvns.ca
PS C:\> Resolve-DnsName -Server 8.8.8.8 -Name jvns.ca
Name Type TTL Section IPAddress
---- ---- --- ------- ---------
jvns.ca AAAA 300 Answer 2606:4700:3031::ac43:b35a
jvns.ca AAAA 300 Answer 2606:4700:3033::6815:5bce
jvns.ca A 300 Answer 104.21.91.206
jvns.ca A 300 Answer 172.67.179.90
Lookup NS type only:
# dig ns jvns.ca
PS C:\> Resolve-DnsName -Name jvns.ca -Type NS
Name Type TTL Section NameHost
---- ---- --- ------- --------
jvns.ca NS 20944 Answer art.ns.cloudflare.com
jvns.ca NS 20944 Answer roxy.ns.cloudflare.com
or
PS C:\> Resolve-DnsName jvns.ca NS
Reverse lookup:
# dig -x 172.217.13.174
PS C:\> Resolve-DnsName -Server 8.8.8.8 -Name 172.217.13.174
Name Type TTL Section NameHost
---- ---- --- ------- --------
174.13.217.172.in-addr.arpa PTR 21600 Answer yul03s04-in-f14.1e100.net
Reverse lookup using PTR type (it will tab-complete through the available -Type options):
PS C:\> Resolve-DnsName -server 8.8.8.8 -Name 174.13.217.172.in-addr.arpa -Type PTR
Name Type TTL Section NameHost
---- ---- --- ------- --------
174.13.217.172.in-addr.arpa PTR 21131 Answer yul03s04-in-f14.1e100.net
The output isn't actually a text table, it's an array of objects, so it's easy to filter and extract data without text parsing:
PS C:\> resolve-dnsname google.com ns |% namehost
ns3.google.com
ns1.google.com
ns4.google.com
ns2.google.com
There's also `-TCPOnly`, `-NoRecursion`, `-NoHostsFile` and other options.
NB. you can get BIND for Windows, and therefore dig.exe for Windows, at https://www.isc.org/download/ https://www.isc.org/download/