<DataSourceModuleType ID="Microsoft.Windows.AD.DomainMemberPerspective.Availability.GroupPolicy.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/GroupPolicyUpdate.vbs$</CommandLine>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<RequireOutput>true</RequireOutput>
<Files>
<File>
<Name>GroupPolicyUpdate.vbs</Name>
<Contents><Script>'*************************************************************************
' Script Name - Group Policy Check
'
' Purpose - Monitors that Group Policy can be successfully applied
'
' (c) Copyright 2014, Microsoft Corporation, All Rights Reserved
' Proprietary and confidential to Microsoft Corporation
'*************************************************************************
Option Explicit
SetLocale("en-us")
Sub Main()
Dim oAPI, oBag, oShell, oShellExec, iResult, iInterval
Set oAPI = CreateObject("Mom.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()
On Error Resume Next
Set oShell = CreateObject("Wscript.Shell")
iResult = oShell.Run("gpupdate", 0, true)
if (iResult <> 0) Then
Set oShellExec = oShell.Exec("gpupdate")
for iInterval = 0 to 30
if oShellExec.Status = 0 then
oBag.AddValue "State", "BAD"
oBag.AddValue "ErrorString", "Group Policy failed to refresh properly. Gpupdate output: " & vbCrLf & vbCrLf & oShellExec.StdOut.ReadAll
Call oAPI.Return(oBag)
Exit sub
End if
wscript.sleep(1000)
Next
oBag.AddValue "State", "BAD"
oBag.AddValue "ErrorString", "Group Policy failed to refresh properly. Gpupdate exited with error code: " & iResult
Else
oBag.AddValue "State", "GOOD"
End If