Using PS for DC Repl data

I’m digging into PS for getting useful replication data from DC’s and have access to all DC’s WinRM ports. However, when I attempt to run something like:

Get-ADReplicationPartnerMetadata -Target * -Scope Server | where {$_.LastReplicationResult -ne "0"}
Get-ADReplicationPartnerMetadata : Unable to contact the server. This may be because this server does not exist, it is currently down, or it does not have the Active Directory Web Services running.

…the help file doesn’t allude to needing this to run via Invoke-Command. Why is it bombing?

Did you put something in Target or just *? Not sure if you were redacting it for posting, but I believe it is required and wildcards are not accepted per the documentation: https://docs.microsoft.com/en-us/powershell/module/activedirectory/get-adreplicationpartnermetadata?view=winserver2012-ps

 

@Mike, * is allowed.

@Jeff
Are you getting output from just

Get-ADReplicationPartnerMetadata -Target * -Scope Server | Select-Object server

My presumption is there is one or more servers that can’t be contacted. and that is why you’re seeing the message. If you run the above command and see output from some servers, perhaps you can see if any are missing.

Hi Doug,

Yes, your one liner does work without issue in our production domain but in our test domain, about half throw that error. I don’t believe it is WinRM because if I run Invoke-Command at them (en masse) I get output from all, no errors.

What is it about this particular set of commandlets that can only return on half across our (TEST) Forest)

Well perhaps like the error says

or it does not have the Active Directory Web Services running.

Are these 2008/R2 servers? Is AD Web Services running on all?

All good Doug…I learned those servers were decommed recently so now hunting for stale DNS records since PowerShell is thinking they are still AD objects