Public/Test-StaticDNSRecords.ps1
Function Test-StaticDNSRecords { param( [Parameter(Mandatory)][string]$ComputerName ) $AllZones = Get-DnsServerZone -ComputerName $ComputerName $Output = foreach ($Zone in $AllZones) { $StaticRecords = $Zone | Get-DnsServerResourceRecord -ComputerName $ComputerName -RRType A | Where-Object Timestamp -EQ $Null | Select-Object HostName, @{n = 'IP'; E = { $_.RecordData.IPV4Address } } foreach ($Record in $StaticRecords) { if ($Record.Hostname -ne "@") { $FQDN = $Record.Hostname + "." + $Zone.ZoneName } else { $FQDN = $Zone.ZoneName } $IsResponding = Test-Connection $FQDN -Quiet -Count 1 [pscustomobject]@{ Hostname = $Record.Hostname IP = $Record.IP Zonename = $Zone.ZoneName FQDN = $FQDN IsResponding = $IsResponding } } } $Output | Sort-Object IsResponding, ZoneName, HostName | Format-Table -AutoSize } |