<DataSourceModuleType ID="Microsoft.Windows.Server.2012.AD.Replication.Queue.DataSource" Accessibility="Internal" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Frequency" type="xsd:int"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TimeoutSeconds" type="xsd:int"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="WarnThreshold" type="xsd:int"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ErrorThreshold" type="xsd:int"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="NumSamples" type="xsd:int"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="Frequency" Selector="$Config/Frequency$" ParameterType="int"/>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
<OverrideableParameter ID="WarnThreshold" Selector="$Config/WarnThreshold$" ParameterType="int"/>
<OverrideableParameter ID="ErrorThreshold" Selector="$Config/ErrorThreshold$" ParameterType="int"/>
<OverrideableParameter ID="NumSamples" Selector="$Config/NumSamples$" ParameterType="int"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="System!System.CommandExecuterPropertyBagSource">
<IntervalSeconds>$Config/Frequency$</IntervalSeconds>
<ApplicationName>%windir%\system32\cscript.exe</ApplicationName>
<WorkingDirectory/>
<CommandLine>//nologo $file/AD_Replication_Queue.vbs$</CommandLine>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<RequireOutput>true</RequireOutput>
<Files>
<File>
<Name>AD_Replication_Queue.vbs</Name>
<Contents><Script>'*************************************************************************
' Script Name - AD Replication Queue
'
' Purpose - Obtains the current number of items in the replication queue.
' - A UnitMonitor will leverage this data to determine if there is a problem or not.
'
' (c) Copyright 2014, Microsoft Corporation, All Rights Reserved
' Proprietary and confidential to Microsoft Corporation
'*************************************************************************
Option Explicit
SetLocale("en-us")
On Error Resume Next
Sub Main()
Dim oBag, oAPI, oWMI, oObjects
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()
Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\MicrosoftActiveDirectory")
Set oObjects = oWMI.ExecQuery("Select * from MSAD_ReplPendingOp")
oBag.AddValue "StatusInstance", ""
oBag.AddValue "StatusValue", "" & CInt(oObjects.Count)