Bezpieczny kanał — źródło danych skryptu

Microsoft.Windows.AD.DomainMemberPerspective.Availability.SecureChannel.DataSource (DataSourceModuleType)

Źródło danych monitorów bezpiecznego kanału.

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$Interwał czasowy w sekundach
TimeoutSecondsint$Config/TimeoutSeconds$Limit czasu w sekundach

Source Code:

<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:" &amp; sDomainName, 0, true)

if (iResult &lt;&gt; 0) Then
Set oShellExec = oShell.Exec("nltest /sc_reset:" &amp; 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: " &amp; vbCrLf &amp; vbCrLf &amp; 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: " &amp; 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

Call oAPI.Return(oBag)
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>