DFS-N:命名空间发现数据源模块

Microsoft.Windows.FileServer.DFSN.6.3.NamespaceDiscovery.DataSourceModuleType (DataSourceModuleType)

此模块通过运行 Win2K8R2DfsNamespaceDiscovery.vbs 脚本发现命名空间。

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityPublic
RunAsDefault
OutputTypeSystem.Discovery.Data

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource Microsoft.Windows.TimedScript.DiscoveryProvider Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
TimeoutSecondsint$Config/TimeoutSeconds$TimeoutSeconds
IntervalSecondsint$Config/IntervalSeconds$IntervalSeconds
DfsutilPathstring$Config/DfsutilPath$DfsutilPath

Source Code:

<DataSourceModuleType ID="Microsoft.Windows.FileServer.DFSN.6.3.NamespaceDiscovery.DataSourceModuleType" Accessibility="Public" Batching="false">
<Configuration>
<xsd:element minOccurs="1" name="SyncTime" type="xsd:string"/>
<xsd:element minOccurs="1" name="TimeoutSeconds" type="xsd:integer"/>
<xsd:element minOccurs="1" name="IntervalSeconds" type="xsd:integer"/>
<xsd:element minOccurs="1" name="DfsutilPath" type="xsd:string"/>
<xsd:element minOccurs="1" name="PrincipalName" type="xsd:string"/>
<xsd:element minOccurs="1" name="NetbiosComputerName" type="xsd:string"/>
<xsd:element minOccurs="1" name="DNSName" type="xsd:string"/>
<xsd:element minOccurs="1" name="ActiveDirectorySite" type="xsd:string"/>
<xsd:element minOccurs="1" name="IsOnVirtualNode" type="xsd:string"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="DfsutilPath" Selector="$Config/DfsutilPath$" ParameterType="string"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedScript.DiscoveryProvider">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<SyncTime>$Config/SyncTime$</SyncTime>
<ScriptName>Win2K8R2DfsNamespaceDiscovery.vbs</ScriptName>
<Arguments>0 $MPElement$ $Target/Id$ $Config/PrincipalName$ $Config/NetbiosComputerName$ $Config/DNSName$ $Config/DfsutilPath$ $Config/ActiveDirectorySite$ $Config/IsOnVirtualNode$</Arguments>
<ScriptBody><Script>'-------------------------------------------------------------------
' &lt;company&gt;Microsoft Corporation&lt;/company&gt;
' &lt;copyright&gt;Copyright (c) Microsoft Corporation. All rights reserved.&lt;/copyright&gt;
' &lt;name&gt;
' Microsoft Windows DFS Namespace Discovery
' &lt;/name&gt;
' &lt;summary&gt;
'
' &lt;/summary&gt;
'-------------------------------------------------------------------
Option Explicit
On Error Resume Next
SetLocale("en-us")
Dim SourceType, SourceID, ManagedEntityId, oArgs, oAPI, sDfsServerName, sDfsServerNetbiosName, sDfsServerFQDN, sIsCluster
Dim objWMIService, oDfsNamespaceColl, oDfsNamespace, oDfsTargetColl, oDfsTarget, oShareColl, oShare, RootDirPath, bIsDC, bAdPerspCreated
Dim oDfsService, oDfsServer, oRel, oDfsAdPersp, oRootTarget, oDiscData, oNamespace, oADSite, sADSiteName, sDfsutilPath, bIsDFSServer

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

Set oArgs = WScript.Arguments
if oArgs.Count &lt; 8 Then
Wscript.Quit -1
End If

SourceType = oArgs(0)
SourceId = oArgs(1)
ManagedEntityId = oArgs(2)
sDfsServerName = oArgs(3)
sDfsServerNetbiosName = oArgs(4)
sDfsServerFQDN = oArgs(5)
sDfsutilPath = oArgs(6)
sIsCluster = "false"
sADSiteName = oArgs(7)

if oArgs.Count &gt; 8 Then
sIsCluster = oArgs(8)
End If

On Error Resume Next
set oDiscData = oAPI.CreateDiscoveryData(SourceType, SourceId, ManagedEntityId)
if Err.Number &lt;&gt; 0 Then
Wscript.Quit -1
End if

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &amp; sDfsServerName &amp; "\root\cimv2")
If Err.Number &lt;&gt; 0 then
Wscript.Quit -1
End If
On Error Goto 0

bIsDC = false
If Not IsDfsNamespaceServer(sDfsServerName) Then
Dim colComputer, objServer

Set colComputer = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For Each objServer in colComputer
If objServer.domainrole &gt;=4 AND objServer.domainrole &lt;=5 Then
bIsDC = true
End If
Next

If Not bIsDC Then
Call oAPI.Return(oDiscData)
WScript.Quit
End If
End If

set oDfsService = oDiscData.CreateClassInstance("$MPElement[Name='Microsoft.Windows.FileServer.DFSN.6.3.Service']$")
call oDfsService.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", sDfsServerName)
call oDfsService.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "DFS Namespace Service")
Call oDiscData.AddInstance(oDfsService)

set oDfsServer = oDiscData.CreateClassInstance("$MPElement[Name='Microsoft.Windows.FileServer.DFSN.6.3.RoleService']$")
call oDfsServer.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", sDfsServerName)
call oDfsServer.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", sDfsServerNetbiosName)
Call oDiscData.AddInstance(oDfsServer)

Set oRel = oDiscData.CreateRelationshipInstance("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.RoleServiceContainsService']$")
oRel.Source = oDfsServer
oRel.Target = oDfsService
Call oDiscData.AddInstance(oRel)

set oADSite = oDiscData.CreateClassInstance("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.ADSite']$")
call oADSite.AddProperty("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.ADSite']/Name$", sADSiteName)
call oADSite.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", sADSiteName)
Call oDiscData.AddInstance(oADSite)

bIsDFSServer = false
Dim oDFS
Set oDFS = New DFS
oDFS.DFSUtilPath = sDfsutilPath &amp; "\" &amp; "dfsutil.exe"
oDFS.DfsServerName = sDfsServerName
bAdPerspCreated = false

For Each oDfsNamespace In oDFS.Roots
If (oDfsNamespace.Initialized = true) Then
For Each oDfsTarget In oDfsNamespace.Targets
If ((StrComp(oDfsTarget.Server, sDfsServerNetbiosName, 1) = 0) OR (StrComp(oDfsTarget.Server, sDfsServerFQDN, 1) = 0)) Then

bIsDFSServer = True
set oNamespace = oDiscData.CreateClassInstance("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.Namespace']$")
call oNamespace.AddProperty("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.Namespace']/NamespaceName$", oDfsNamespace.Name)
call oNamespace.AddProperty("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.Namespace']/State$", GetState(oDfsNamespace.State, 0))
call oNamespace.AddProperty("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.Namespace']/Timeout$", oDfsNamespace.Timeout)
call oNamespace.AddProperty("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.Namespace']/NamespaceType$", oDfsNamespace.RootType)
call oNamespace.AddProperty("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.Namespace']/LinksCount$", oDfsNamespace.LinksCount)
call oNamespace.AddProperty("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.Namespace']/RootTargetsCount$", oDfsNamespace.TargetsCount)
call oNamespace.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", oDfsNamespace.Name)
Call oDiscData.AddInstance(oNamespace)

RootDirPath = oDfsTarget.Folder
Set oShareColl = objWMIService.ExecQuery("Select * from Win32_Share where Name='" &amp; oDfsTarget.Folder &amp; "'")
for each oShare in oShareColl
If (StrComp(oShare.Name,oDfsTarget.Folder,1) = 0) Then
RootDirPath = oShare.Path
End If
Next
set oRootTarget = oDiscData.CreateClassInstance("$MPElement[Name='Microsoft.Windows.FileServer.DFSN.6.3.RootTarget']$")
call oRootTarget.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", sDfsServerName)
If (StrComp(sIsCluster, "true", 1) &lt;&gt; 0) Then
call oRootTarget.AddProperty("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.RootTarget']/RootName$", oDfsTarget.Folder)
Else
call oRootTarget.AddProperty("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.RootTarget']/RootName$", oDfsTarget.Folder &amp; "-" &amp; sDfsServerNetbiosName)
End If
call oRootTarget.AddProperty("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.RootTarget']/State$", GetState(oDfsTarget.State, 1))
call oRootTarget.AddProperty("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.RootTarget']/NamespaceName$", oDfsNamespace.Name)
call oRootTarget.AddProperty("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.RootTarget']/RootDirectory$", RootDirPath)
call oRootTarget.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", oDfsTarget.Name)
Call oDiscData.AddInstance(oRootTarget)

Set oRel = oDiscData.CreateRelationshipInstance("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.NamespaceContainsRootTargets']$")
oRel.Source = oNamespace
oRel.Target = oRootTarget
Call oDiscData.AddInstance(oRel)

If (oDfsNamespace.RootType = "Domain") Then

If Not bAdPerspCreated Then
set oDfsAdPersp = oDiscData.CreateClassInstance("$MPElement[Name='Microsoft.Windows.FileServer.DFSN.6.3.ADPerspective']$")
call oDfsAdPersp.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", sDfsServerName)
call oDfsAdPersp.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Dfs Namespace Role Service")
Call oDiscData.AddInstance(oDfsAdPersp)
bAdPerspCreated = true
End If

Set oRel = oDiscData.CreateRelationshipInstance("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.RootTargetContainsADPerspective']$")
oRel.Source = oRootTarget
oRel.Target = oDfsAdPersp
Call oDiscData.AddInstance(oRel)
End If

Set oRel = oDiscData.CreateRelationshipInstance("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.RoleServiceContainsRootTargets']$")
oRel.Source = oDfsServer
oRel.Target = oRootTarget
Call oDiscData.AddInstance(oRel)

Set oRel = oDiscData.CreateRelationshipInstance("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.RootTargetContainsService']$")
oRel.Source = oRootTarget
oRel.Target = oDfsService
Call oDiscData.AddInstance(oRel)

Set oRel = oDiscData.CreateRelationshipInstance("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.ADSiteContainsRootTargets']$")
oRel.Source = oADSite
oRel.Target = oRootTarget
Call oDiscData.AddInstance(oRel)
End If

Next
End If
oDfsNamespace.DeleteXMLFile
Next

If Not bIsDFSServer AND Not bIsDC AND sIsCluster = "true" Then
Dim oEmptyDiscData
set oEmptyDiscData = oAPI.CreateDiscoveryData(SourceType, SourceId, ManagedEntityId)
Call oAPI.Return(oEmptyDiscData)
WScript.Quit
End If
Call oAPI.Return(oDiscData)

Function GetState(ByVal iState, ByVal bIsTarget)
iState= iState AND 15
If bIsTarget =1 Then
Select Case iState
Case "1":
GetState = "OFFLINE"
Case "2":
GetState = "ONLINE"
Case "4":
GetState = "ACTIVE"
Case Else
GetState = iState
End Select
Else
Select Case iState
Case "1":
GetState = "OK"
Case "2":
GetState = "INCONSISTENT"
Case "3":
GetState = "OFFLINE"
Case "4":
GetState = "ONLINE"
Case Else
GetState = iState
End Select
End If
End Function


Function IsDfsNamespaceServer(ByVal sServerName)
Dim oError
Set oError = New Error
oError.Clear
On Error Resume Next

Dim arrStdKeys, arrDomKeys, oReg, arrDomV2Keys

IsDfsNamespaceServer = False
const HKEY_LOCAL_MACHINE = &amp;H80000002
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &amp; sServerName &amp; "\root\default:StdRegProv")
oError.Save
On Error Goto 0
If oError.Number &lt;&gt; 0 Then
WScript.Quit -1
End If

Const DFS_KEY_DOMAIN = "SOFTWARE\Microsoft\Dfs\Roots\Domain"
Const DFS_KEY_DOMAINV2 = "SOFTWARE\Microsoft\Dfs\Roots\domainV2"
Const DFS_KEY_STD = "SOFTWARE\Microsoft\Dfs\Roots\Standalone"

oReg.EnumKey HKEY_LOCAL_MACHINE, DFS_KEY_STD, arrStdKeys

If IsArray(arrStdKeys) Then
If UBound(arrStdKeys) &gt;= 0 Then
IsDfsNamespaceServer = True
Exit Function
End If
End If

oReg.EnumKey HKEY_LOCAL_MACHINE, DFS_KEY_DOMAIN, arrDomKeys

If IsArray(arrDomKeys) Then
If UBound(arrDomKeys) &gt;= 0 Then
IsDfsNamespaceServer = True
Exit Function
End If
End If

oReg.EnumKey HKEY_LOCAL_MACHINE, DFS_KEY_DOMAINV2, arrDomV2Keys

If IsArray(arrDomV2Keys) Then
If UBound(arrDomV2Keys) &gt;= 0 Then
IsDfsNamespaceServer = True
Exit Function
End If
End If

End Function


Function GetWmiState(ByVal iState, ByVal bIsTarget)
If bIsTarget =1 Then
Select Case iState
Case "0":
GetWmiState = "OFFLINE"
Case "1":
GetWmiState = "ONLINE"
Case "2":
GetWmiState = "ACTIVE"
Case Else
GetWmiState = iState
End Select
Else
Select Case iState
Case "0":
GetWmiState = "OK"
Case "1":
GetWmiState = "INCONSISTENT"
Case "2":
GetWmiState = "ONLINE"
Case "3":
GetWmiState = "OFFLINE"
Case Else
GetWmiState = iState
End Select
End If
End Function

Function GetRootType(ByVal sRootName)
Dim objSysInfo
Dim oError
Set oError = New Error
oError.Clear
On Error Resume Next
Set objSysInfo = CreateObject("ADSystemInfo")
oError.Save
On Error Goto 0
If oError.Number &lt;&gt; 0 then
GetRootType = ""
Exit Function
End If
If ((Instr(1,sRootName, "\\" &amp; objSysInfo.DomainShortName,1) &lt;&gt; 1) AND (Instr(1,sRootName, "\\" &amp; objSysInfo.DomainDNSName,1) &lt;&gt; 1)) Then
GetRootType = "Standalone"
Else
GetRootType = "Domain"
End If
End Function

Function IsValidObject(ByVal oObject)
IsValidObject = False

If IsObject(oObject) Then
If Not oObject Is Nothing Then
IsValidObject = True
End If
End If
End Function

Sub RunCommand (ByVal sCommand, ByRef iErrCode, ByRef sOutput, ByRef sError)
Dim oShell, oFSO, oOut

Set oShell = MomCreateObject("WScript.Shell")
Set oFSO = MomCreateObject("Scripting.FileSystemObject")

sError = ""
sOutput = ""
Dim sOutputFileName
sOutputFileName = GenerateGUID() &amp; ".out"
Dim sErrorFileName
sErrorFileName = GenerateGUID() &amp; ".err"
Dim sFullCommand
sFullCommand = "cmd /c " &amp; sCommand &amp; " &gt; " &amp; sOutputFileName &amp; " 2&gt; " &amp; sErrorFileName
iErrCode = oShell.run(sFullCommand, 2, true)
On Error Resume Next
Set oOut = oFSO.OpenTextFile(sOutputFileName)
On Error Goto 0
If IsValidObject(oOut) Then
On Error Resume Next
sOutput = oOut.ReadAll()
On Error Goto 0
oOut.Close
Else
WScript.Quit -1
End If
On Error Resume Next
oFSO.DeleteFile sOutputFileName
On Error Goto 0
If iErrCode &lt;&gt; 0 Then
Dim oErrorFile
On Error Resume Next
Set oErrorFile = oFSO.OpenTextFile(sErrorFileName)
On Error Goto 0
If IsValidObject(oErrorFile) Then
On Error Resume Next
sError = oErrorFile.ReadAll()
On Error Goto 0
oErrorFile.Close
End If
If sError = "" Then sError = sOutput
End If
On Error Resume Next
oFSO.DeleteFile sErrorFileName
On Error Goto 0
End Sub


Sub ParseForRoots (ByVal sDFSUtilOutput, ByRef oRootNames)
' Gets a string of the output from a successful run (error code = 0)
' of the DFS Util, parse out the list of roots and return the roots.

Dim rExp, sSearch, oMatches

Set rExp = new regexp
rExp.Global = True
rExp.IgnoreCase = True

' Match anything that starts with a tab and anything that's
' not a new line character. (till the end of the line)
rExp.Pattern = "\t[^(\n)]+"

' Parse for the roots...
Set oRootNames = rExp.Execute(sDFSUtilOutput)
End Sub



Function GenerateGUID()
Dim oTypeLib
Set oTypeLib = MomCreateObject("Scriptlet.TypeLib")

Dim sNewGUID
sNewGUID = oTypeLib.Guid

GenerateGUID = Left(sNewGUID, Len(sNewGUID)-2)
End Function


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 &lt;&gt; 0 Then
WScript.Quit -1
End If
End Function

Class Error
Private m_lNumber
Private m_sSource
Private m_sDescription
Private m_sHelpContext
Private m_sHelpFile

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

Class DFS
Private m_sDFSUtilPath
Private m_sDfsServerName

Public Property Get DFSUtilPath
DFSUtilPath = m_sDFSUtilPath
End Property

Public Property Let DFSUtilPath(ByVal sPath)
Dim oShell
Set oShell = MomCreateObject("WScript.Shell")
m_sDFSUtilPath = oShell.ExpandEnvironmentStrings(sPath)
End Property

Public Property Let DfsServerName(ByVal sDfsServer)
m_sDfsServerName = sDfsServer
End Property

Public Property Get Roots
Dim sDFSCommand
sDFSCommand = """""" &amp; m_sDFSUtilPath &amp; """ /Server:" &amp; m_sDfsServerName &amp; " /view"""
Dim iErrorCode
Dim sOutput
Dim sError
RunCommand sDFSCommand, iErrorCode, sOutput, sError
Dim aRoots()

If iErrorCode &lt;&gt; 0 Then
Roots = aRoots
Exit Property
End If

Dim oRootNames
ParseForRoots sOutput, oRootNames
Dim sRootName, sRootType
ReDim aRoots(oRootNames.Count - 1)
Dim i
For i = 0 To oRootNames.Count - 1
sRootName = "\" &amp; Replace(oRootNames(i), vbTab, "")
sRootType = GetRootType(sRootName)

Set aRoots(i) = New DFSRoot
aRoots(i).Initialize sRootName, sRootType, m_sDFSUtilPath
Next
Roots = aRoots
End Property
End Class


Class DFSRoot
Private m_oXMLElement
Private m_sName
Private m_sType
Private m_sXMLFileLocation

Private m_isInitialized


Public Sub DeleteXMLFile()
SetXMLElement Nothing
If m_sXMLFileLocation &lt;&gt; "" Then
Dim oFSO
Set oFSO = MomCreateObject("Scripting.FileSystemObject")
oFSO.DeleteFile m_sXMLFileLocation
End If
End Sub

Public Sub Initialize(ByVal sName, ByVal sType, ByVal sDFSUtilPath)
m_sName = sName
m_sType = sType
DeleteXMLFile
m_sXMLFileLocation = GenerateGUID() &amp; ".xml"
m_isInitialized = true

Dim sDFSCommand
sDFSCommand = """""" &amp; sDFSUtilPath &amp; """ /root:""" &amp; sName &amp; """ /export:" &amp; m_sXMLFileLocation &amp; """"
Dim iErrorCode
Dim sOutput
Dim sError
RunCommand sDFSCommand, iErrorCode, sOutput, sError

If iErrorCode &lt;&gt; 0 Then
' Error occurred while running the dfsutil command
m_isInitialized = false
Else
Dim oXDFSResults
Set oXDFSResults = MomCreateObject("MSXML2.DOMDocument")
oXDFSResults.validateOnParse = True

' Load the dfsutil result xml file
oXDFSResults.load(m_sXMLFileLocation)

If oXDFSResults.ParseError.ErrorCode &lt;&gt; 0 Then
m_isInitialized = false
End If

SetXMLElement oXDFSResults.SelectSingleNode("/Root")
End If
End Sub

Public Property Get Initialized
Initialized = m_isInitialized
End Property

Public Property Get Name
Name = m_sName
End Property

Public Property Get RootType
RootType = m_sType
End Property

Public Property Get State
State = CInt(m_oXMLElement.SelectSingleNode("@State").Value)
End Property

Public Property Get Timeout
Timeout = m_oXMLElement.SelectSingleNode("@Timeout").Value
End Property

Public Property Get Targets
Dim oTargetXMLElements
Set oTargetXMLElements = m_oXMLElement.SelectNodes("Target")
ReDim aTargets(oTargetXMLElements.length - 1)
Dim i
For i = 0 To oTargetXMLElements.length - 1
Set aTargets(i) = New DFSRootTarget
aTargets(i).SetXMLElement oTargetXMLElements.item(i)
Next
Targets = aTargets
End Property

Public Property Get TargetsCount
Dim oTargetXMLElements
Set oTargetXMLElements = m_oXMLElement.SelectNodes("Target")
TargetsCount = oTargetXMLElements.length
End Property


Public Property Get LinksCount
Dim oLinkXMLElements
Set oLinkXMLElements = m_oXMLElement.SelectNodes("Link")
LinksCount = oLinkXMLElements.length
End Property

Public Sub SetXMLElement(ByVal oXMLElement)
Set m_oXMLElement = oXMLElement
End Sub
End Class

Class DFSRootTarget
Private m_oXMLElement

Public Property Get Name
Name = "\\" &amp; Server &amp; "\" &amp; Folder
End Property

Public Property Get State
State = CInt(m_oXMLElement.SelectSingleNode("@State").Value)
End Property

Public Property Get Server
Server = m_oXMLElement.SelectSingleNode("@Server").Value
End Property

Public Property Get Folder
Folder = m_oXMLElement.SelectSingleNode("@Folder").Value
End Property

Public Sub SetXMLElement(ByVal oXMLElement)
Set m_oXMLElement = oXMLElement
End Sub
End Class

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