<DataSourceModuleType ID="Microsoft.Windows.AD.DomainMemberPerspective.Availability.SecureChannel.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/SecureChannel.vbs$</CommandLine>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<RequireOutput>true</RequireOutput>
<Files>
<File>
<Name>SecureChannel.vbs</Name>
<Contents><Script>'*************************************************************************
' Script Name - Secure Channel Check
'
' Purpose - Monitors that the machine is able to establish a secure channel with the domain
'
' (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, oWMI, colItems, oItem, sDomainName, iInterval
Set oAPI = CreateObject("Mom.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()
Set oWMI = GetObject( "winmgmts:\\.\root\cimv2" )
Set colItems = oWMI.ExecQuery( "Select * from Win32_ComputerSystem", , 48 )
For Each oItem in colItems
sDomainName = oItem.Domain
If oItem.PartOfDomain Then
Set oShell = CreateObject("Wscript.Shell")
iResult = oShell.Run("cmd.exe /c nltest /sc_reset:" & sDomainName, 0, true)
if (iResult <> 0) Then
Set oShellExec = oShell.Exec("nltest /sc_reset:" & sDomainName)
for iInterval = 0 to 30
if oShellExec.Status = 0 then
oBag.AddValue "State", "BAD"
oBag.AddValue "ErrorString", "Unable to establish a secure channel with the domain. Nltest output: " & vbCrLf & vbCrLf & oShellExec.StdErr.ReadAll
Call oAPI.Return(oBag)
Exit sub
End if
wscript.sleep(1000)
Next
oBag.AddValue "State", "BAD"
oBag.AddValue "ErrorString", "Unable to establish a secure channel with the domain. Nltest exited with error code: " & iResult
Else
oBag.AddValue "State", "GOOD"
End If
Else
oBag.AddValue "State", "BAD"
oBag.AddValue "ErrorString", "The server is currently not joined to a domain and therefore cannot establish a secure channel."
End If
Next