search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Posted in Windows Powershell, Windows Server | 2 Comments | 2,440 views | 14/03/2014 10:09

You can check all reverse DNS records with DNS records with following script to see if they are equal:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$Servers = Get-DnsServerResourceRecord -ZoneName contoso.domain.com
 
foreach ($Server in $Servers)
{
	# Clear Values
	$ServerName = $Null;
	$DNSName = $Null;
	$DNSHostName = $Null;
	$DNSIPAddress = $Null;
	$ReverseDNSHostName = $Null;
 
	# Resolve DNS Name
	$ServerName = $Server.HostName
	$DNSName = (Resolve-DnsName $ServerName)
 
	if ($DNSName)
	{	
		# Get Reverse DNS Name
		$DNSHostName = $DNSName.Name
		$DNSIPAddress = $DNSName.IPAddress
		$ReverseDNSHostName = ([System.Net.Dns]::GetHostByAddress("$DNSIPAddress")).HostName
 
		if ($DNSHostName -eq $ReverseDNSHostName -and $ReverseDNSHostName -ne $Null)
		{
			Write-Host "."
		}
		else
		{
			$Output = $DNSHostName + ";" + $ReverseDNSHostName
			Write-Host $Output
		}
	}
	else
	{
		Write-Host "Cannot resolve $ServerName"
	}
}

If they are not equal, that will output results.
You should run this script on a Windows Server 2012/R2 DNS server with elevated privileges.