rhymeswithmogul / Resolve-DnsNameCrossPlatform

An implementation of PowerShell's Resolve-DnsName cmdlet that works on all operating systems (requires dig).

Home Page:https://www.powershellgallery.com/packages/Resolve-DnsNameCrossPlatform/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Resolve-DnsNameCrossPlatform

The Resolve-DnsNameCrossPlatform cmdlet performs a DNS query for the specified name. This cmdlet is functionally similar to the nslookup tool or the Windows-only Resolve-DnsName cmdlet, both of which allow users to query for names.

This module exists because Resolve-DnsName is not available on non-Windows platforms. On macOS and Linux, this cmdlet will call out to the dig command. dig is included with recent versions of macOS, but Linux users may need to install the bind-utils package.

Please note that this project is in a pre-alpha status.

Examples

You may use Resolve-DnsNameCrossPlatform much like you'd use Resolve-DnsName. Even the output objects are designed to be similar.

Resolve-DnsNameCrossPlatform -Name www.bing.com
Resolve-DnsNameCrossPlatform -Name www.bing.com -Server 10.0.0.1
Resolve-DnsNameCrossPlatform -Name www.bing.com -Type A

Supported Parameters

Not all parameters of Resolve-DnsName can be supported, as dig has no concept of NetBIOS or LLMNR. At this time, the following will work:

Parameter Description
DnsOnly Resolves this query using only the DNS protocol. This is the only option supported by this cmdlet, and is implied; specifying it changes nothing.
DnssecCd Sets the DNSSEC checking-disabled bit for this query.
DnssecOk Sets the DNSSEC OK bit for this query.
Name Specifies the name to be resolved. (Mandatory.)
NoIdn Specifies not to use IDN encoding logic for the query.
NoRecursion Instructs the server to not use recursion when resolving this query.
Server Specifies the IP addresses or host name of the DNS servers to be queried. By default the interface DNS servers are queried if this parameter is not supplied. (Note that, at this time, only the first DNS server will be used.)
TcpOnly Uses only TCP for this query.
Type Specifies the DNS query type that is to be issued. By default the type is A_AAAA; the A and AAAA types will both be queried.

Supported Types

The following values are currently supported for the Type parameter. Note that they cannot be specified by number at this time.

  • UNKNOWN = 0,
  • A_AAAA = 0, the DNS query type is A_AAAA.
  • A = 1, the DNS query type is IPv4 server Address.
  • AAAA = 28, the DNS query type is IPv6 server address.
  • NS = 2, the DNS query type is name server.
  • MX = 15, the DNS query type is mail routing information.
  • MD = 3, the DNS query type is mail destination.
  • MF = 4, the DNS query type is mail forwarder.
  • CNAME = 5, the DNS query type is canonical name.
  • SOA = 6, the DNS query type is start of authority zone.
  • MB = 7, the DNS query type is mailbox domain name.
  • MG = 8, the DNS query type is mail group member.
  • MR = 9, the DNS query type is mail rename name.
  • NULL = 10, the DNS query type is null resource record.
  • WKS = 11, the DNS query type is well known service.
  • PTR = 12, the DNS query type is domain name pointer.
  • HINFO = 13, the DNS query type is host information.
  • MINFO = 14, the DNS query type is mailbox information.
  • TXT = 16, the DNS query type is text strings.
  • RP = 17, the DNS query type is responsible person.
  • AFSDB = 18, the DNS query type is AFS database servers.
  • X25 = 19, the DNS query type is packet switched wide area network.
  • ISDN = 20, the DNS query type is Integrated Services Digital Network.
  • RT = 21, the DNS query type is DNS route through.
  • SRV = 33, the DNS query type is server selection.
  • DNAME = 39, the DNS query type is domain aliases.
  • OPT = 41, the DNS query type is DNS option.
  • DS = 43, the DNS query type is delegation signer.
  • RRSIG = 46, the DNS query type is DNSSEC signature.
  • NSEC = 47, the DNS query type is next-secure record.
  • DNSKEY = 48, the DNS query type is DNS key record.
  • DHCID = 49, the DNS query type is Dynamic Host Configuration Protocol information.
  • NSEC3 = 50, the DNS query type is NSEC record version 3.
  • NSEC3PARAM = 51, the DNS query type is NSEC3 parameters.
  • ANY = 255, the DNS query type is wildcard match.
  • ALL = 255, the DNS query type is wildcard match.

Outputs

The output will consist of zero or more objects, that will contain all of the records returned from the wire for the specified DNS query.

They will be of the following types:

  • Windows: Microsoft.DnsClient.Commands.DnsRecord
  • macOS and Linux: PSCustomObject(s) with similar properties, methods, and aliases as the objects returned by Windows' Resolve-DnsName.

About

An implementation of PowerShell's Resolve-DnsName cmdlet that works on all operating systems (requires dig).

https://www.powershellgallery.com/packages/Resolve-DnsNameCrossPlatform/

License:GNU Affero General Public License v3.0


Languages

Language:PowerShell 100.0%