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

Configure User’s Folder Redirection with Group Policy

February 3, 2023

Join a Windows Computer to an Active Directory...

February 2, 2023

Using Previous Command History in PowerShell Console

January 31, 2023

How to Install the PowerShell Active Directory Module...

January 31, 2023

Finding Duplicate E-mail (SMTP) Addresses in Exchange

January 27, 2023

Leave a Comment Cancel Reply

Categories

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

Recent Posts

  • Configure User’s Folder Redirection with Group Policy

    February 3, 2023
  • Using Previous Command History in PowerShell Console

    January 31, 2023
  • How to Install the PowerShell Active Directory Module and Manage AD?

    January 31, 2023
  • Finding Duplicate E-mail (SMTP) Addresses in Exchange

    January 27, 2023
  • How to Delete Old User Profiles in Windows?

    January 25, 2023
  • How to Install Free VMware Hypervisor (ESXi)?

    January 24, 2023
  • How to Enable TLS 1.2 on Windows?

    January 18, 2023
  • Allow or Prevent Non-Admin Users from Reboot/Shutdown Windows

    January 17, 2023
  • Fix: Can’t Extend Volume in Windows

    January 12, 2023
  • Wi-Fi (Internet) Disconnects After Sleep or Hibernation on Windows 10/11

    January 11, 2023

Follow us

woshub.com
  • Facebook
  • Twitter
  • RSS
Popular Posts
  • Changing Desktop Background Wallpaper in Windows through GPO
  • How to Disable NTLM Authentication in Windows Domain?
  • Active Directory Dynamic User Groups with PowerShell
  • Restricting Group Policy with WMI Filtering
  • LAPS: Manage Local Administrator Passwords on a Domain Computers
  • How to Add, Edit, Deploy and Import Registry Keys through GPO?
  • How to Check Who Reset the Password of a User in Active Directory
Footer Logo

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


Back To Top