repadmin using powershell


Today, I’m going to try and mimic a popular repadmin command switch, /showrepl, with PowerShell and the AD replication cmdlets. Take a look at the following, hybrid command:

repadmin/showrepl*/csv|ConvertFrom-Csv|Out-GridView

The /showrepl switch tells repadmin to show the inbound replication status, for all partitions for a designated domain controller. The * tells repadmin to execute against ALL domain controllers. The /csv switch produces output that can be saved to a CSV files. If an executable can produce output in a CSV format, it’s much easier to get that output into objects so PowerShell can do its amazing stuff. We pipe the output of the repadmin command into ConvertFrom-CSV; the resultant objects are then piped into Out-Gridview for an interactive table. Here’s a sample:

 

Now, let’s do something similar with the Get-ADReplicationPartnerMetaData cmdlet:

Get-ADReplicationPartnerMetadata-Target*-Partition*|

Select-ObjectServer,Partition,Partner,ConsecutiveReplicationFailures,LastReplicationSuccess,LastRepicationResult|

Out-GridView

We’re targeting all servers the wildcard supplied to the -Target parameter. The wildcard supplied to the -Partition parameter ensures that details for the Schema, Configuration and Domain partitions are included. Select-Object is used to provide a view similar to that of repadmin. Again, Out-Gridview is used to provide an interactive table. Here’s a sample:

 

 

Right, I’m off to see what other repadmin functionality I can reproduce with the Active Directory replication cmdlets. The king is dead… well, actually, the king is probably going to be round for a little while yet, so long live the young pretender

Source:

http://blogs.technet.com/b/poshchap/archive/2014/06/06/active-directory-replication-cmdlets-vs-repadmin.aspx

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: