Guest User

Untitled

a guest
Jul 23rd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. Describe 'Domain Controllers' {
  2.  
  3. Context 'Replication Link Status' {
  4.  
  5. $results = repadmin /showrepl * /csv | ConvertFrom-Csv # Get the results of all replications between all DCs
  6.  
  7. $groups = $results | Group-Object -Property 'Source DSA' # Group the results by the source DC
  8.  
  9. foreach ($sourcedsa in $groups) {
  10. # Create a context for each source DC
  11.  
  12. Context "Source DSA = $($sourcedsa.Name)" {
  13.  
  14. $targets = $sourcedsa.Group # Assign the value of the groupings to another var since .Group doesn't implement IComparable
  15.  
  16. $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)
  17.  
  18. foreach ($target in $targetdsa ) {
  19. # Create a context for each destination DSA
  20.  
  21. Context "Target DSA = $($target.Name)" {
  22.  
  23. foreach ($entry in $target.Group) {
  24. # List out the results and check each naming context for failures
  25.  
  26. It "$($entry.'Naming Context') - should have zero replication failures" {
  27. $entry.'Number of failures' | Should Be 0
  28. }
  29. }
  30. }
  31. }
  32. }
  33. }
  34. }
  35. }
Add Comment
Please, Sign In to add comment