I running script on domain controller
repadmin /showrepl * /csv >showrepl.csv = export to CSV file can see all the DC in forrest.
and repadmin /showrepl * /csv
Why when run script repadmin /showrepl * /csv = Report cannot get information from all DC in forrest. But can show some DC in forrest.
#Check the Replication with Repadmin
$workfile = c:\rep\repadmin.exe /showrepl * /csv
$results = ConvertFrom-Csv -InputObject $workfile | where {$_.'Number of Failures' -ge 1}
$strOutFile = "c:\rep\Check-Replication.htm"
#Here you set the tolerance level for the report
#$results = $workfile | where {$_.'Number of Failures' -gt 1 }
if ($results -ne $null ) {
$results = $results | select "Source DC", "Destination DC", "Naming Context" , "Last Failure Time", "Last Success Time" | ConvertTo-Html
} else {
$results = "There were no Replication Errors"
}
Send-MailMessage -From $from -To $to -Subject "Daily Forest Replication Status" -SmtpServer "mailserver" -BodyAsHtml ($results | Out-String)
$filedate = get-date
$filedate = $filedate.ToString()
$results = "" + $filedate + "" + $results + ""
$results | Out-File $strOutFile