Repadmin is a standard tool in an AD admin’s toolbox, and “showrepl” displays the status of replication in your domain. The results of this command are quite verbose, and can make your eyes glaze over in late night troubleshooting. A number of people have noticed that you can pipe RepAdmin CSV output to the ConvertFrom-CSV cmdlet in PowerShell. I wanted a little more than what others had done. The script below is my effort. It (naturally) requires repadmin and the Out-Gridview cmdlet.
#Test-Replication #Alan dot Kaplan at VA dot GOV #11-21-2016 #Requires -version 3 Add-Type -assemblyname Microsoft.visualBasic $bonlyFailures = $false $FQDNExample = [system.net.dns]::GetHostEntry($env:computername).hostname $msg = "This will check replication using repadmin. You may check a single DC, ex: $FQDNExample, or a all DCs in a domain, ex: *`.$env:userdnsdomain`." $SearchScope = [Microsoft.VisualBasic.Interaction]::InputBox($msg, "Check Replication", "*`.$env:userdnsdomain") if (!($searchScope)){Exit} $msg = "1) Show all results 2) Show only errors 3) Exit" $retval = [Microsoft.VisualBasic.Interaction]::InputBox($msg, "Errors Only?",2 ) switch ($retval) { 1 {$ShowIfGE = 0} 2 {$ShowIfGE = 1} Default {Exit} } $props = "Source DSA,Source DSA Site,Destination DSA,Destination DSA Site,Naming Context,Number of Failures,Last Failure Status,Last Failure Time,Last Success Time,Transport Type".Split(",") $retval = repadmin /showrepl $searchscope /csv | ConvertFrom-Csv | Where {$_.'Number Of Failures' -ge $ShowIfGE} if ($retval){ $retval | Select $props | Sort 'Source DSA', 'Destination DSA' | out-gridview -Title "Replication Status for $searchscope" }ELSE{ Write "No replication errors found for $searchscope" }