Stato individuato della risorsa cluster cartella replicata

Microsoft.Windows.FileServer.DFSR.6.3.ClusterReplicatedFolderState (DataSourceModuleType)

Mappa lo stato rilevato della risorsa cluster della cartella replicata a uno stato di integrità.

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityPublic
RunAsMicrosoft.Windows.FileServer.DFSR.MonitoringAccount
OutputTypeSystem.PropertyBagData

Member Modules:

ID Module Type TypeId RunAs 
StateDS DataSource Microsoft.Windows.TimedScript.PropertyBagProvider Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
IntervalSecondsint$Config/IntervalSeconds$IntervalSeconds
SyncTimestring$Config/SyncTime$SyncTime
TimeoutSecondsint$Config/TimeoutSeconds$TimeoutSeconds

Source Code:

<DataSourceModuleType ID="Microsoft.Windows.FileServer.DFSR.6.3.ClusterReplicatedFolderState" Accessibility="Public" RunAs="DFSRLib!Microsoft.Windows.FileServer.DFSR.MonitoringAccount" Batching="false">
<Configuration>
<xsd:element minOccurs="1" name="IntervalSeconds" type="xsd:integer"/>
<xsd:element minOccurs="1" name="SyncTime" type="xsd:string"/>
<xsd:element minOccurs="1" name="TimeoutSeconds" type="xsd:integer"/>
<xsd:element minOccurs="1" name="ElementState" type="xsd:string"/>
<xsd:element minOccurs="1" name="ServerName" type="xsd:string"/>
<xsd:element minOccurs="1" name="ResourceName" type="xsd:string"/>
<xsd:element minOccurs="1" name="ResourceDiscoveryState" type="xsd:string"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string"/>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="StateDS" TypeID="Windows!Microsoft.Windows.TimedScript.PropertyBagProvider">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<SyncTime>$Config/SyncTime$</SyncTime>
<ScriptName>DFSRGetState.vbs</ScriptName>
<Arguments>$Config/ServerName$ $Config/ResourceName$ $Config/ResourceDiscoveryState$</Arguments>
<ScriptBody><Script>
SetLocale("en-us")
On Error Resume Next

Dim oAPI, oBag, oArgs, ElementState, sState, sDfsrServerName
Dim objClusterWMI, oResourceInfoList, oResourceInfo, dfsrClusterResourceName, dfsrClusterResourceState

Set oAPI = CreateObject("MOM.ScriptAPI")
If Err.Number &lt;&gt; 0 Then
Wscript.Quit -1
End if

Set oArgs = WScript.Arguments

if oArgs.Count &lt; 2 Then
Wscript.Quit -1
End If

sDfsrServerName = oArgs(0)
dfsrClusterResourceName = "DFSR " &amp; oArgs(1)
dfsrClusterResourceState = oArgs(2)

Set objClusterWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &amp; sDfsrServerName &amp; "\root\mscluster")
if Err.Number &lt;&gt; 0 then
strErr = "Unable to connect to local mscluster WMI provider. Error: 0x" &amp; Hex(Err.Number) &amp; " " &amp; Err.Description
WScript.Echo strErr
Err.Clear
Else
Set oResourceInfoList = objClusterWMI.ExecQuery ("Select State from MSCluster_Resource where Name='" &amp; Replace(dfsrClusterResourceName, "\", "\\") &amp; "'")
if Err.Number &lt;&gt; 0 then
strErr = "Unable to query MSCluster_Resource from local mscluster WMI provider. Error: 0x" &amp; Hex(Err.Number) &amp; " " &amp; Err.Description
WScript.Echo strErr
Err.Clear
End If
End If

for each oResourceInfo in oResourceInfoList

Select Case oResourceInfo.State
Case 1
dfsrClusterResourceState = "INITIALIZING"

Case 2
dfsrClusterResourceState = "ONLINE"

Case 3
dfsrClusterResourceState = "OFFLINE"

Case 4
dfsrClusterResourceState = "FAILED"

Case 128
dfsrClusterResourceState = "PENDING"

Case 129
dfsrClusterResourceState = "ONLINE PENDING"

Case 130
dfsrClusterResourceState = "OFFLINE PENDING"

End Select

Exit For
Next


Set oBag = oAPI.CreatePropertyBag()

If Err.Number &lt;&gt; 0 Then
Wscript.Quit -1
End if

Call oBag.AddValue("ElementState", dfsrClusterResourceState)

Call oAPI.Return(oBag)

</Script></ScriptBody>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
</DataSource>
</MemberModules>
<Composition>
<Node ID="StateDS"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.PropertyBagData</OutputType>
</DataSourceModuleType>