Replication Consistency Script Data Source

Microsoft.Windows.Server.2012.AD.Configuration.ReplicationConsistency.DataSource (DataSourceModuleType)

Data Source for the Replication Consistency monitors.

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityInternal
RunAsDefault
OutputTypeSystem.PropertyBagData

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource System.CommandExecuterPropertyBagSource Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
IntervalSecondsint$Config/IntervalSeconds$FrequencyHow often the monitor is run
TimeoutSecondsint$Config/TimeoutSeconds$TimeoutTime out in Sec

Source Code:

<DataSourceModuleType ID="Microsoft.Windows.Server.2012.AD.Configuration.ReplicationConsistency.DataSource" Accessibility="Internal" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="IntervalSeconds" type="xsd:int"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TimeoutSeconds" type="xsd:int"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="System!System.CommandExecuterPropertyBagSource">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<ApplicationName>%windir%\system32\cscript.exe</ApplicationName>
<WorkingDirectory/>
<CommandLine>//nologo $file/AD_Replication_Consistency.vbs$</CommandLine>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<RequireOutput>true</RequireOutput>
<Files>
<File>
<Name>AD_Replication_Consistency.vbs</Name>
<Contents><Script>'*************************************************************************
' Script Name - Replication Consistency
'
' Purpose - Monitors that strict replication consistency is set on the DC
'
' (c) Copyright 2014, Microsoft Corporation, All Rights Reserved
' Proprietary and confidential to Microsoft Corporation
'*************************************************************************
Option Explicit

SetLocale("en-us")

Sub Main()

Dim oAPI, oBag

Set oAPI = CreateObject("Mom.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()

Const HKEY_CURRENT_USER = &amp;H80000001
const HKEY_LOCAL_MACHINE = &amp;H80000002
Dim strComputer
strComputer = "."

'Check the registry for Strict Replication Consistency. If not set throw an error.
On Error Resume Next
Dim oReg, strKeyPath, strValueName, dwValue
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &amp;_
strComputer &amp; "\root\default:StdRegProv")
strKeyPath = "System\CurrentControlSet\Services\NTDS\Parameters"
strValueName = "Strict Replication Consistency"
oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
WScript.Echo "Strict Replication Consistency: " &amp; dwValue

Dim strError
If (Err.Number &lt;&gt; 0) Then
strError = "Failed to connect to registry hive HKLM." &amp; vbcrlf
strError = strError &amp; "Verify that the agent has access to view the registry."
oBag.AddValue "State", "BAD"
oBag.AddValue "ErrorString", strError
oAPI.AddItem oBag
ElseIf dwValue &lt;&gt; 1 Then
strError = "The strict replication consistency is not enabled." &amp; vbCrLf
strError = strError &amp; vbCrLf &amp; "Technet article outlining how to enable Strict replication:" &amp; vbCrLf
strError = strError &amp; "https://technet.microsoft.com/en-us/library/cc816938(v=ws.10).aspx"
oBag.AddValue "State", "BAD"
oBag.AddValue "ErrorString", strError
oAPI.AddItem oBag
Else
oBag.AddValue "State", "GOOD"
oAPI.AddItem oBag
End If

oAPI.ReturnItems

End Sub

Call Main()
</Script></Contents>
<Unicode>1</Unicode>
</File>
</Files>
</DataSource>
</MemberModules>
<Composition>
<Node ID="DS"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.PropertyBagData</OutputType>
</DataSourceModuleType>