This object discovers volumes hosting replicated folders on computers running Windows Server 2008.
This object discovers volumes hosting replicated folders on computers running Windows Server 2008. It does so by using the VolumesDiscovery2008.vbs script to query the DfsrVolumeInfo WMI class.
Users with Author or Administrator permissions in Operations Manager can use overrides to change the following parameters:
IntervalSeconds controls how often Operations Manager runs the discovery process.
Timeoutseconds controls how long to wait for discovery to complete.
DfsrVolumeInfo WMI class on MSDN (http://go.microsoft.com/fwlink/?LinkID=165543)
How to Override a Monitor (http://go.microsoft.com/fwlink/?LinkId=171027)
Target | Microsoft.Windows.FileServer.DFSR.2008.Service |
Enabled | True |
Frequency | 14400 |
Remotable | False |
Discovered Classes and their attribuets: |
---|
|
Discovered relationships and their attribuets: |
ID | Module Type | TypeId | RunAs |
---|---|---|---|
Microsoft.Windows.TimedScript.DiscoveryProvider | DataSource | Microsoft.Windows.TimedScript.DiscoveryProvider | Microsoft.Windows.FileServer.DFSR.MonitoringAccount |
<Discovery ID="Microsoft.Windows.FileServer.DFSR.2008.VolumeDiscovery" Enabled="true" Target="Microsoft.Windows.FileServer.DFSR.2008.Service" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="DFSRLib!Microsoft.Windows.FileServer.DFSR.Volume">
<Property TypeID="DFSRLib!Microsoft.Windows.FileServer.DFSR.Volume" PropertyID="IsClustered"/>
<Property TypeID="DFSRLib!Microsoft.Windows.FileServer.DFSR.Volume" PropertyID="ClusterResourceName"/>
<Property TypeID="DFSRLib!Microsoft.Windows.FileServer.DFSR.Volume" PropertyID="State"/>
<Property TypeID="DFSRLib!Microsoft.Windows.FileServer.DFSR.Volume" PropertyID="DatabasePath"/>
<Property TypeID="DFSRLib!Microsoft.Windows.FileServer.DFSR.Volume" PropertyID="VolumeGUID"/>
<Property TypeID="System!System.Entity" PropertyID="DisplayName"/>
<Property TypeID="DFSRLib!Microsoft.Windows.FileServer.DFSR.Volume" PropertyID="ClusterGroupName"/>
</DiscoveryClass>
<DiscoveryRelationship TypeID="DFSRLib!Microsoft.Windows.FileServer.DFSR.Service.Contains.Volumes"/>
</DiscoveryTypes>
<DataSource ID="Microsoft.Windows.TimedScript.DiscoveryProvider" RunAs="DFSRLib!Microsoft.Windows.FileServer.DFSR.MonitoringAccount" TypeID="Windows!Microsoft.Windows.TimedScript.DiscoveryProvider">
<IntervalSeconds>14400</IntervalSeconds>
<SyncTime/>
<ScriptName>VolumesDiscovery2008.vbs</ScriptName>
<Arguments>0 $MPElement$ $Target/Id$ $Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$ $Target/Property[Type="DFSRLib!Microsoft.Windows.FileServer.DFSR.Service"]/IsVirtualNode$</Arguments>
<ScriptBody> Option Explicit
On Error Resume Next
Dim SourceType, SourceID, ManagedEntityId, oArgs, oAPI, sDfsrServerName, VolumeInfo, VolumeInfoList, volumeQuery
Dim objWMIService, oVolumeConfig, oVolumeConfigCollection, ReplicatedFolderList, validVolumeConfig
SetLocale("en-us")
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oArgs = WScript.Arguments
if oArgs.Count < 3 Then
call oAPI.LogScriptEvent("VolumesDiscovery2008.vbs", 100, 1, "Expected 3 arguments. There were only " & oArgs.Count & " arguments. Exiting script.")
Wscript.Quit -1
End If
Dim oDiscData, oDfsrServer, stateStr, oRel, oDfsrServerRole, IsVirtualNode
SourceType = oArgs(0)
SourceId = oArgs(1)
ManagedEntityId = oArgs(2)
sDfsrServerName = oArgs(3)
if (oArgs.Count = 5) then
IsVirtualNode = oArgs(4)
else
IsVirtualNode = "False"
end if
If IsVirtualNode = "True" then
Wscript.Quit
End If
set oDiscData = oAPI.CreateDiscoveryData(SourceType, SourceId, ManagedEntityId)
set oDfsrServerRole = oDiscData.CreateClassInstance("$MPElement[Name='Microsoft.Windows.FileServer.DFSR.2008.Service']$")
call oDfsrServerRole.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", sDfsrServerName)
Call oDiscData.AddInstance(oDfsrServerRole)
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & sDfsrServerName & "\root\microsoftdfs")
if Err.Number <> 0 then
strErr = "Unable to connect to local DFSR WMI provider. Error: 0x" & Hex(Err.Number) & " " & Err.Description
WScript.Echo strErr
Wscript.Quit -1
End If
volumeQuery = "Select VolumeGuid, VolumePath, DatabasePath from DfsrVolumeConfig"
Set oVolumeConfigCollection = objWMIService.ExecQuery(volumeQuery)
if Err.Number <> 0 then
strErr = "Unable to query DfsrVolumeConfig from local DFSR WMI provider. Error: 0x" & Hex(Err.Number) & " " & Err.Description
Wscript.Echo strErr
Wscript.Quit -1
End If
for each oVolumeConfig in oVolumeConfigCollection
stateStr = "UNINITIALIZED"
validVolumeConfig = true
set oDfsrServer = oDiscData.CreateClassInstance("$MPElement[Name='DFSRLib!Microsoft.Windows.FileServer.DFSR.Volume']$")
call oDfsrServer.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", sDfsrServerName)
call oDfsrServer.AddProperty("$MPElement[Name='DFSRLib!Microsoft.Windows.FileServer.DFSR.Volume']/VolumeGUID$", oVolumeConfig.VolumeGuid)
call oDfsrServer.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", Mid(oVolumeConfig.VolumePath, 5))
call oDfsrServer.AddProperty("$MPElement[Name='DFSRLib!Microsoft.Windows.FileServer.DFSR.Volume']/DatabasePath$", Mid(oVolumeConfig.DatabasePath, 5))
call oDfsrServer.AddProperty("$MPElement[Name='DFSRLib!Microsoft.Windows.FileServer.DFSR.Volume']/ClusterResourceName$", "N/A")
call oDfsrServer.AddProperty("$MPElement[Name='DFSRLib!Microsoft.Windows.FileServer.DFSR.Volume']/IsClustered$", "N/A")
call oDfsrServer.AddProperty("$MPElement[Name='DFSRLib!Microsoft.Windows.FileServer.DFSR.Volume']/ClusterGroupName$", "N/A")
Set VolumeInfoList = objWMIService.ExecQuery ("Select State from DfsrVolumeInfo Where VolumeGuid ='" & oVolumeConfig.VolumeGuid & "'")
if Err.Number <> 0 then
strErr = "Unable to query DfsrVolumeInfo from local DFSR WMI provider. Error: 0x" & Hex(Err.Number) & " " & Err.Description
WScript.Echo strErr
Err.Clear
oDiscData.IsSnapshot=false
Else
for each VolumeInfo in VolumeInfoList
Select Case VolumeInfo.State
Case 0
stateStr = "INITIALIZED"
Case 1
stateStr = "SHUTTING DOWN"
Case 2
stateStr = "IN ERROR"
Case 3
stateStr = "AUTO RECOVERY"
Case else
stateStr = "INVALID STATE"
End Select
Next
End If
REM
REM DFSR in some cases leaves the volume manager running and also fail to delete volume XML. when really there is no replicated
REM folders remaining and are all deleted. To handle this case, we will query DfsrReplicatedFolderConfig for folders with
REM volume GUID matching and if there are none then we will not add this volume instance, as this is just a stale object
REM
Set ReplicatedFolderList = objWMIService.ExecQuery ("Select Enabled from DfsrReplicatedFolderConfig Where VolumeGuid ='" & oVolumeConfig.VolumeGuid & "'")
If Err.Number <> 0 then
strErr = "Unable to query DfsrReplicatedFolderConfig from local DFSR WMI provider. Error: 0x" & Hex(Err.Number) & " " & Err.Description
WScript.Echo strErr
Err.Clear
oDiscData.IsSnapshot=false
Else
If ReplicatedFolderList.Count = 0 then
validVolumeConfig = false
End If
End If
If validVolumeConfig = true then
call oDfsrServer.AddProperty("$MPElement[Name='DFSRLib!Microsoft.Windows.FileServer.DFSR.Volume']/State$", stateStr)
Call oDiscData.AddInstance(oDfsrServer)
Set oRel = oDiscData.CreateRelationshipInstance("$MPElement[Name='DFSRLib!Microsoft.Windows.FileServer.DFSR.Service.Contains.Volumes']$")
oRel.Source = oDfsrServerRole
oRel.Target = oDfsrServer
Call oDiscData.AddInstance(oRel)
End If
Next
Call oAPI.Return(oDiscData) </ScriptBody>
<TimeoutSeconds>900</TimeoutSeconds>
</DataSource>
</Discovery>