cls
Remove-Variable -Name * -Force -ErrorAction SilentlyContinue
$comp1 = 'DNSServer1'
$comp2 = 'DNSServer2'
$bonefish = Get-WmiObject -Class MicrosoftDNS_Zone -ComputerName $comp1 -Namespace root\microsoftDNS | Where {$_.ZoneType -eq '2' -or $_.ZoneType -eq '1'} | Select Name
$bonefish2 = Get-WmiObject -Class MicrosoftDNS_Zone -ComputerName $comp2 -Namespace root\microsoftDNS | Where {$_.ZoneType -eq '2' -or $_.ZoneType -eq '1'} | Select Name
$comparison = compare-object $bonefish $bonefish2 -Property name
if ($comparison -ne $null)
{
$mycol = @()
foreach ($c in $comparison)
{
switch ($c.SideIndicator)
{
"=>" {
{
write-host $comp2 "has the zone" $c.Name $comp1 "does not"
$output = "`r" + $comp2 + " has the zone " + $c.Name + " " + $comp1 + " does not."
$output
$myCol += $output
}
}
"<=" {
write-host $comp1 "has the zone" $c.Name $comp2 "does not"
$output = "`r" + $comp1 + " has the zone " + $c.Name + " " + $comp2 + " does not."
$output
$myCol += $output
}
} # End Switch
# End foreach
}
No comments:
Post a Comment