Get-DnsClientCache

Retrieve the content of the local DNS client cache.

Syntax
      Get-DnsClientCache [[-Entry] String[]] [-CimSession CimSession[]] [-Data String[]]
         [-DataLength UInt16[]] [-Name String[]] [-Section Section[]] [-Status Status[]]
            [-ThrottleLimit Int32] [-TimeToLive UInt32[]] [-Type Type[]]  [CommonParameters]

Key
   -CimSession [CimSession[]]
       Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such 
       as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

   -Data [String[]]
       Specifies the record data.

   -DataLength [UInt16[]]
       Specifies the record data length.

   -Entry [String[]]
       Specifies the cache entry name.

   -Name [String[]]
       Specifies the record name.

   -Section [Section[]]
       Specifies the record section. The acceptable values for this parameter are:

        -- Answer
        -- Authority
        -- Additional

   -Status [Status[]]
       Specifies the record status. The acceptable values for this parameter are:
        
        -- Success
        -- NotExist
        -- NoRecords

   -ThrottleLimit [Int32]
       Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this 
       parameter is omitted or a value of 0 is entered, then Windows PowerShell® calculates an optimum throttle limit 
       for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies 
       only to the current cmdlet, not to the session or to the computer.

   -TimeToLive [UInt32[]]
       Specifies the record time-to-live, in seconds.

   -Type [Type[]]
       Specifies the record type. The acceptable values for this parameter are:
        
        -- A
        -- NS
        -- CNAME
        -- SOA
        -- PTR
        -- MX
        -- AAAA
        -- SRV

Examples

Get the DNS client cache:

PS C:\> Get-DnsClientCache

List all the available properties (not the display names):

PS C:\> Get-DnsClientCache | Format-List -Property * -Force

Use a pair of hash tables to decode the numeric output from Get-DnsClientCache, (this is done automatically with the default output):

# Hash table of Types
$dnsTypes = @{
[uint16]1 = "A"
[uint16]2 = "NS"
[uint16]5 = "CNAME"
[uint16]6 = "SOA"
[uint16]12 = "PTR"
[uint16]15 = "MX"
[uint16]28 = "AAA"
[uint16]33 = "SRV"
}

# Hash table of Status
$dnsStatus = @{
[uint32]0 = "Success"
[uint32]9003 = "NotExist"
[uint32]9701 = "NoRecords"
}

get-dnsclientcache | Select-Object name,type, status | ForEach-object {
$out=$_.name + " = " + $dnsTypes[$_.type] + " = " + $dnsStatus[$_.status]
$out
}

# hash table values via learn.microsoft.com

“Muddy water, let stand - becomes clear” ~ Lao Tzu

Related PowerShell Cmdlets

Clear-DnsClientCache - Clear the content of the DNS client cache.
IPCONFIG - ip configuration.


 
Copyright © 1999-2024 SS64.com
Some rights reserved