r/PowerShell • u/Wireless_Life • Feb 12 '19
PowerShell Basics: Troubleshooting Active Directory Replication Issues
https://techcommunity.microsoft.com/t5/ITOps-Talk-Blog/PowerShell-Basics-How-to-Troubleshoot-Active-Directory/ba-p/329872?WT.mc_id=ITOPSTALK-reddit-abartolo2
u/Wireless_Life Feb 12 '19
Microsoft MVP, Dishan Francis, details certain windows cmdlets and utilities which can be use for Active Directory replication issues troubleshooting.
4
u/SoMundayn Feb 12 '19
I put a quick PowerShell script in place last week at my company to get replication checks working with SolarWinds, as by default they do not have a monitor that does this...
# Checks Replication Against the DC IP
$Replication = Get-ADReplicationFailure ${IP}
# If in the response more than 1 failure is found, it will alert.
IF ($Replication | Where-Object {$_.FailureCount -ge "2"}) {
Write-Host "Message: More than 1 Replication Error Found";
Write-Host "Statistic: 1";
Exit 1;
}
# If $Replication is found, but no errors, then no errors found
#Or if nothing is reported back, then it shows no replication partner found.
ELSE {
IF ($Replication) {
Write-Host "Message: No errors found in replication";
Write-Host "Statistic: 0";
Exit 0;
} ELSE {
Write-Host "Message: No Replication Partner found";
Write-Host "Statistic: 0";
Exit 0;
}
}1
u/AutoModerator Feb 12 '19
Sorry, your submission has been automatically removed.
Accounts must be at least 1 day old, which prevents the sub from filling up with bot spam.
Try posting again tomorrow or message the mods to approve your post.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
11
u/positivemark Feb 12 '19
I have a Github repo with some Pester tests that can be used to do a fairly detailed validation of active directory in case anyone is interested: https://github.com/markwragg/Test-ActiveDirectory