PowerShell for Windows Admins

Feb 5 2012   2:06PM GMT

Testing replication



Posted by: Richard Siddaway
Active Directory, PowerShell, WMI

We’ve seen a few things we can do with the WMI provider for Active Directory. One of the most useful is testing replication

function test-replication{            
[CmdletBinding()]            
param(            
 [string]$computername=$env:COMPUTERNAME            
)            
Get-WmiObject -Namespace root\MicrosoftActiveDirectory -Class MSAD_ReplNeighbor -ComputerName $computername|            
select SourceDsaCN, NamingContextDN,             
@{N="LastSyncAttempt"; E={$_.ConvertToDateTime($_.TimeOfLastSyncAttempt)}},            
@{N="LastSyncSuccess"; E={$_.ConvertToDateTime($_.TimeOfLastSyncSuccess)}}             
}

A simple call to the MSAD_ReplNeigbor and we can test the last times the DCs attempted to synchronise and the last time they were successful

Comment on this Post

Leave a comment: