< Back

Get-Dns

Wed Jan 15, 2020 2:09 am

NAME Get-Dns



SYNOPSIS

Get a DNS resource record from a DNS server.





SYNTAX

Get-Dns [[-Name] <String>] [[-RecordType] {EMPTY | A | NS | MD | MF | CNAME | SOA | MB | MG | MR | NULL | WKS |

PTR | HINFO | MINFO | MX | TXT | RP | AFSDB | X25 | ISDN | RT | NSAP | NSAPPTR | SIG | KEY | PX | GPOS | AAAA |

LOC | NXT | EID | NIMLOC | SRV | ATMA | NAPTR | KX | CERT | A6 | DNAME | SINK | OPT | APL | DS | SSHFP | IPSECKEY

| RRSIG | NSEC | DNSKEY | DHCID | NSEC3 | NSEC3PARAM | TLSA | SMIMEA | HIP | NINFO | RKEY | TALINK | CDS | CDNSKEY

| OPENPGPKEY | CSYNC | ZONEMD | SPF | UINFO | UID | GID | UNSPEC | NID | L32 | L64 | LP | EUI48 | EUI64 | TKEY |

TSIG | IXFR | AXFR | MAILB | MAILA | ANY | URI | CAA | AVC | DOA | AMTRELAY | TA | DLV | WINS | WINSR | UNKNOWN}]

[-RecordClass {IN | CH | HS | NONE | ANY}] [-NoRecursion] [-DnsSec] [-EDns] [-EDnsBufferSize <UInt16>]

[-DisableIdnConversion] [-NoTcpFallback] [-SearchList <String[]>] [-Tcp] [-Port <UInt16>] [-Timeout <Byte>]

[-IPv6] [-ComputerName <String>] [-DnsDebug] [<CommonParameters>]





DESCRIPTION

Get-Dns is a debugging resolver tool similar to dig and nslookup.





PARAMETERS

-Name <String>

A resource name to query, by default Get-Dns will use '.' as the name. IP addresses (IPv4 and IPv6) are

automatically converted into an appropriate format to aid PTR queries.



Required? false

Position? 2

Default value .

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-RecordType

Any resource record type, by default a query for ANY will be sent.



Required? false

Position? 3

Default value ANY

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-RecordClass

By default the class is IN. CH (Chaos) may be used to query for name server information. HS (Hesoid) may be

used if the name server supports it.



Required? false

Position? named

Default value IN

Accept pipeline input? false

Accept wildcard characters? false



-NoRecursion [<SwitchParameter>]

Remove the Recursion Desired (RD) flag from a query. Recursion is requested by default.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-DnsSec [<SwitchParameter>]

Advertise support for DNSSEC when executing a query.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-EDns [<SwitchParameter>]

Enable EDNS support, suppresses OPT RR advertising client support in DNS question. Automatically enabled if

DNSSEC is requested.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-EDnsBufferSize <UInt16>

By default the EDns buffer size is set to 4096 bytes.



Required? false

Position? named

Default value 4096

Accept pipeline input? false

Accept wildcard characters? false



-DisableIdnConversion [<SwitchParameter>]

Disables conversion of international domain names to unicode in responses.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-NoTcpFallback [<SwitchParameter>]

Disable the use of TCP if a truncated response (TC flag) is seen when using UDP.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-SearchList <String[]>

If a name is not root terminated (does not end with '.') a SearchList will be used for recursive queries. If

this parameter is not defined Get-Dns will attempt to retrieve a SearchList from the hosts network

configuration.



An empty search list by be specified by providing an empty array for this parameter.



Required? false

Position? named

Default value (GetDnsSuffixSearchList)

Accept pipeline input? false

Accept wildcard characters? false



-Tcp [<SwitchParameter>]

Recursive, or version, queries can be forced to use TCP by setting the TCP switch parameter.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Port <UInt16>

By default, DNS uses TCP or UDP port 53. The port used to send queries may be changed if a server is listening

on a different port.



Required? false

Position? named

Default value 53

Accept pipeline input? false

Accept wildcard characters? false



-Timeout <Byte>

By default, queries will timeout after 5 seconds. The value may be set between 1 and 30 seconds.



Required? false

Position? named

Default value 5

Accept pipeline input? false

Accept wildcard characters? false



-IPv6 [<SwitchParameter>]

Force the use of IPv6 for queries, if this parameter is set and the ComputerName is set to a name (e.g.

ns1.domain.example), Get-Dns will attempt to locate an AAAA record for the server.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-ComputerName <String>

A server name or IP address to execute a query against. If an IPv6 address is used Get-Dns will attempt the

query using IPv6 (enables the IPv6 parameter).



If a name is used another lookup will be required to resolve the name to an IP. Get-Dns caches responses for

queries performed involving the Server parameter. The cache may be viewed and maintained using the

*-InternalDnsCache CmdLets.



If no server name is defined, the Get-DnsServerList command is used to discover locally configured DNS servers.



Required? false

Position? named

Default value (Get-DnsServerList -IPv6:$IPv6 | Select-Object -First 1)

Accept pipeline input? false

Accept wildcard characters? false



-DnsDebug [<SwitchParameter>]

Forces Get-Dns to output intermediate requests which would normally be hidden, such as NXDomain replies when

using a SearchList.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

DnsMessage





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-Dns hostname



Attempt to resolve hostname using the system-configured search list.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-Dns www.domain.example



The system-configured search list will be appended to this query before it is executed.









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-Dns www.domain.example.



The name is fully-qualified (or root terminated), no additional suffixes will be appended.









-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Get-Dns example. -DnsSec



Request ANY record for the co.uk domain, advertising DNSSEC support.











RELATED LINKS