Created
July 23, 2018 14:41
-
-
Save lwsrbrts/b3d7e47531780b1de038addcd092fda1 to your computer and use it in GitHub Desktop.
A pester test to check domain controller replications, grouping by source DC. Obviously requires repadmin.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Describe 'Domain Controllers' { | |
Context 'Replication Link Status' { | |
$results = repadmin /showrepl * /csv | ConvertFrom-Csv # Get the results of all replications between all DCs | |
$groups = $results | Group-Object -Property 'Source DSA' # Group the results by the source DC | |
foreach ($sourcedsa in $groups) { | |
# Create a context for each source DC | |
Context "Source DSA = $($sourcedsa.Name)" { | |
$targets = $sourcedsa.Group # Assign the value of the groupings to another var since .Group doesn't implement IComparable | |
$targetdsa = $targets | Group-Object -Property 'Destination DSA' # Now group within this source DC by the destination DC (pulling naming contexts per source and destination together) | |
foreach ($target in $targetdsa ) { | |
# Create a context for each destination DSA | |
Context "Target DSA = $($target.Name)" { | |
foreach ($entry in $target.Group) { | |
# List out the results and check each naming context for failures | |
It "$($entry.'Naming Context') - should have zero replication failures" { | |
$entry.'Number of failures' | Should Be 0 | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Curious why not Get-ADReplicationPartnerMetaData ?