<DataSourceModuleType ID="Microsoft.Windows.FileServer.DFSN.Library.DFSPathAvailDataSourceModuleType" Accessibility="Public" 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="UNCPaths" type="xsd:string"/>
<xsd:element minOccurs="1" name="TimeoutSeconds" type="xsd:integer"/>
</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="DS" TypeID="Windows!Microsoft.Windows.TimedScript.PropertyBagProvider">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<SyncTime>$Config/SyncTime$</SyncTime>
<ScriptName>DFSNClientSideMonitoring.vbs</ScriptName>
<Arguments>$Config/UNCPaths$</Arguments>
<ScriptBody><Script>
SetLocale("en-us")
On Error Resume Next
Dim oAPI, oBag, oArgs, TargetState
Set oArgs = WScript.Arguments
Set oAPI = CreateObject("MOM.ScriptAPI")
If Err.Number <> 0 Then
Wscript.Quit -1
End if
Set oBag = oAPI.CreatePropertyBag()
If Err.Number <> 0 Then
Wscript.Quit -1
End if
TargetState = "Accessible"
if oArgs.Count < 1 Then
Call oBag.AddValue("TargetState", TargetState)
Call oAPI.Return(oBag)
Wscript.Quit
End If
Dim aRootNames
aRootNames = Split(CStr(oArgs(0)), ":")
Dim oFSO
Set oFSO = MomCreateObject("Scripting.FileSystemObject")
Dim e
Set e = New Error
Dim sTargetPath
Dim oFolder
Dim oFile
For Each sTargetPath In aRootNames
On Error Resume Next
Set oFolder = oFSO.GetFolder(sTargetPath)
e.Save
On Error Goto 0
If e.Number <> 0 Then
TargetState = "NotAccessible"
call oAPI.LogScriptEvent("DFSNClientSideMonitoring.vbs", 107, 1, "The DFS client side monitoring routine detected that the following destination is unreachable:" & vbCrLf & vbCrLf & sTargetPath & vbCrLf & vbCrLf & "The error code is: " & e.Description)
End If
Next
Call oBag.AddValue("TargetState", TargetState)
Call oAPI.Return(oBag)
Function MomCreateObject(ByVal sProgramId)
Dim oError
Set oError = New Error
On Error Resume Next
Set MomCreateObject = CreateObject(sProgramId)
oError.Save
On Error Goto 0
If oError.Number <> 0 Then
'call oAPI.LogScriptEvent("DFSNClientSideMonitoring.vbs", 101, 1, "Unable to create automation object '" & sProgramId & "'")
WScript.Quit -1
End If
End Function
Public Sub Save()
m_lNumber = Err.number
m_sSource = Err.Source
m_sDescription = Err.Description
m_sHelpContext = Err.HelpContext
m_sHelpFile = Err.helpfile
End Sub
Public Sub Raise()
Err.Raise m_lNumber, m_sSource, m_sDescription, m_sHelpFile, m_sHelpContext
End Sub
Public Sub Clear()
m_lNumber = 0
m_sSource = ""
m_sDescription = ""
m_sHelpContext = ""
m_sHelpFile = ""
End Sub
Public Default Property Get Number()
Number = m_lNumber
End Property
Public Property Get Source()
Source = m_sSource
End Property
Public Property Get Description()
Description = m_sDescription
End Property
Public Property Get HelpContext()
HelpContext = m_sHelpContext
End Property
Public Property Get HelpFile()
HelpFile = m_sHelpFile
End Property
End Class </Script></ScriptBody>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
</DataSource>
</MemberModules>
<Composition>
<Node ID="DS"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.PropertyBagData</OutputType>
</DataSourceModuleType>