r/PowerShell • • 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-abartolo
119 Upvotes

11 comments sorted by

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

4

u/SoMundayn Feb 12 '19

Hey Mark,

Good job. I'm still trying to improve my PS skills since you taught that class last year at work. May be able to guess who it is from my name.

Cheers!

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

u/Arcontar Feb 12 '19

Great work ;)

0

u/[deleted] Feb 12 '19

[deleted]

5

u/Arcontar Feb 12 '19

(shameless plug) Take a look here: https://www.mczerniawski.pl/powershell/remove-rds-server-with-a-bit-of-pester/# And here https://github.com/PPOSHGROUP/PPoShOVFDiagnostics (Currently being rewritten) - for psconf eu 2019 And here (last year session) https://youtu.be/SoBFCEiIps8 ;)

2

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

u/bask00 Feb 13 '19

Thanks for sharing!!