Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Active Directory / Troubleshooting Active Directory Replication Using PowerShell

November 12, 2018 Active DirectoryPowerShell

Troubleshooting Active Directory Replication Using PowerShell

Most AD administrators use the repadmin (appeared in Windows Server 2003) and replmon (must be copied from Support Tool for WS2003) console tools to monitor and control Active Directory replication. In Windows Server 2012, Microsoft added a number of PowerShell cmdlets to manage and check replication status in the Active Directory forest. In this article we’ll look at the main useful PoSh cmdlets that an AD administrator can use to control replication between domain controllers.

The cmdlets for managing and monitoring AD replication are a part of Active Directory Module for Windows PowerShell. You can enable it on the desktop Windows editions after RSAT installation. To import the module into a PowerShell session, run this command:

Import-Module ActiveDirectory

Active Directory Module for Windows PowerShell

Note. Active Directory Module for PowerShell is automatically imported on the domain controllers starting from Windows Server 2012 R2 or later.

You can display the full list of replication-related cmdlets in the ActiveDirectory module as follows:

get-command -module activedirectory -name *ADReplicat*

AD Replication managment Powershell cmdlets

To collect the information about replication failures for the specific domain controller, use the Get-ADReplicationFailure cmdlet:

Get-ADReplicationFailure -Target DC1

If there are no errors, the cmdlet will return nothing. Otherwise, you will see the list of failed objects and the causes of replication errors.

You can query multiple DCs at once:

Get-ADReplicationFailure -Target DC1,DC2

Get-ADReplicationFailure

In this case, you can see that there was the domain controller dc2 (link failure) connection problem on February, 22, but there are no errors at the moment.

To quickly get the replication status for all DCs on the specified site:

Get-ADReplicationFailure -scope site -target Madrid | FT Server, LastError, Partner-Auto

Or for all domain controllers in the domain or in the forest (-Scope Forest):

Get-ADReplicationFailure -Target "woshub.com" -Scope Domain

Get-ADReplicationConnection cmdlet is used to display information about the replication partners for the current domain controller.

Get-ADReplicationConnection -Filter *

If you want to display the replication connections for the specific DC, run this command:

Get-ADReplicationConnection -Filter {ReplicateToDirectoryServer -eq "DC2"}

To force synchronization of the specific object between domain controllers, Sync-ADObject cmdlet is used. For example, let’s consider the case when an AD object has been deleted, moved to the AD Recycle Bin and then restored. After the object has been restored, you can force replication of the recovered object to all domain controllers using Sync-ADObject cmdlet:

Get-ADDomainController -filter * | foreach {Sync-ADObject -Object "cn=John Silvia,cn=Users,dc=woshub,dc=com" -source DC1 -Destination $_.hostname}

Get-ADReplicationPartnerMetadata cmdlet enables getting information about the replication of metadata between DCs and partners. For example, to get the information about the time of the last try to perform replication with a partner and the time of the last successful replication for all DCs, enter the following command:

Get-ADReplicationPartnerMetadata -Target "$env:userdnsdomain" -Scope Domain | Select-Object Server, LastReplicationAttempt, LastReplicationSuccess, Partner

Get-ADReplicationPartnerMetadata

You can get the replication status of a certain object:

Get-ADReplicationAttributeMetadata -Object "CN=Maggie Skosana,OU=Users,DC=woshub,DC=com" -Server DC1

Using Get-ADReplicationQueueOperation cmdlet, you can get the list of pending replication operations on the specific server.

Get-ADReplicationUpToDatenessVectorTable cmdlet allows to get the list of USN values for replication partners:

Get-ADReplicationUpToDatenessVectorTable * | ft Partner,Server,UsnFilter

Thus, PowerShell is a powerful and convenient tool for replication monitoring and troubleshooting in the AD forest, which can be a 100% substitute for repadmin in the Active Directory replication management tasks. You can use Powershell along with the dcdiag and repadmin tools to check the health of your Active Directory domain.

0 comment
1
Facebook Twitter Google + Pinterest
previous post
How to See Number of Active User Sessions on IIS site?
next post
“Downloading updates 0%” Issue on Windows Server 2016 and Windows 10

Related Reading

Using PowerShell Behind a Proxy Server

July 1, 2022

Checking Windows Activation Status on Active Directory Computers

June 27, 2022

Configuring Multiple VLAN Interfaces on Windows

June 24, 2022

How to Disable or Enable USB Drives in...

June 24, 2022

Adding Domain Users to the Local Administrators Group...

June 23, 2022

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows 7
  • Windows Server 2019
  • Windows Server 2016
  • Windows Server 2012 R2
  • PowerShell
  • VMWare
  • Hyper-V
  • MS Office

Recent Posts

  • Using PowerShell Behind a Proxy Server

    July 1, 2022
  • How to Access VMFS Datastore from Linux, Windows, or ESXi?

    July 1, 2022
  • How to Deploy Windows 10 (11) with PXE Network Boot?

    June 27, 2022
  • Checking Windows Activation Status on Active Directory Computers

    June 27, 2022
  • Configuring Multiple VLAN Interfaces on Windows

    June 24, 2022
  • How to Disable or Enable USB Drives in Windows using Group Policy?

    June 24, 2022
  • Adding Domain Users to the Local Administrators Group in Windows

    June 23, 2022
  • Viewing a Remote User’s Desktop Session with Shadow Mode in Windows

    June 23, 2022
  • How to Create a Wi-Fi Hotspot on your Windows PC?

    June 23, 2022
  • Configuring SSH Public Key Authentication on Windows

    June 15, 2022

Follow us

woshub.com

ad

  • Facebook
  • Twitter
  • RSS
Popular Posts
  • How to Configure Google Chrome Using Group Policy ADMX Templates?
  • Get-ADComputer: Find Computer Details in Active Directory with PowerShell
  • Changing Desktop Background Wallpaper in Windows through GPO
  • How to Disable NTLM Authentication in Windows Domain?
  • Restricting Group Policy with WMI Filtering
  • Active Directory Dynamic User Groups with PowerShell
  • How to Add, Edit, Deploy and Import Registry Keys through GPO?
Footer Logo

@2014 - 2018 - Windows OS Hub. All about operating systems for sysadmins


Back To Top