DFS Replication Service Configuration Discovery (Windows Server 2003 R2)

Microsoft.Windows.FileServer.DFSR.2003.ServiceDiscovery (Discovery)

This object discovers configuration information for the DFS Replication service on computers running Windows Server 2003 R2.

Knowledge Base article:

Summary

This object discovers configuration information for the DFS Replication service on computers running Windows Server 2003 R2. It does so by running the DFSRServiceDiscovery2003.vbs script which queries the DfsrMachineConfig WMI class for configuration settings including the following:

Configuration

Users with Author or Administrator permissions in Operations Manager can use overrides to change the following parameters:

Additional

Element properties:

TargetMicrosoft.Windows.FileServer.DFSR.2003.Service
EnabledTrue
Frequency14400
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:

Member Modules:

ID Module Type TypeId RunAs 
Microsoft.Windows.TimedScript.DiscoveryProvider DataSource Microsoft.Windows.TimedScript.DiscoveryProvider Microsoft.Windows.FileServer.DFSR.MonitoringAccount

Source Code:

<Discovery ID="Microsoft.Windows.FileServer.DFSR.2003.ServiceDiscovery" Enabled="true" Target="Microsoft.Windows.FileServer.DFSR.2003.Service" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Microsoft.Windows.FileServer.DFSR.2003.Service">
<Property TypeID="DFSRLib!Microsoft.Windows.FileServer.DFSR.Service" PropertyID="State"/>
<Property TypeID="DFSRLib!Microsoft.Windows.FileServer.DFSR.Service" PropertyID="DebugLogFilePath"/>
<Property TypeID="DFSRLib!Microsoft.Windows.FileServer.DFSR.Service" PropertyID="ConflictHighWatermarkPercent"/>
<Property TypeID="DFSRLib!Microsoft.Windows.FileServer.DFSR.Service" PropertyID="ConflictLowWatermarkPercent"/>
<Property TypeID="DFSRLib!Microsoft.Windows.FileServer.DFSR.Service" PropertyID="StagingHighWatermarkPercent"/>
<Property TypeID="DFSRLib!Microsoft.Windows.FileServer.DFSR.Service" PropertyID="StagingLowWatermarkPercent"/>
<Property TypeID="DFSRLib!Microsoft.Windows.FileServer.DFSR.Service" PropertyID="IsRoDriverLoaded"/>
<Property TypeID="System!System.Entity" PropertyID="DisplayName"/>
</DiscoveryClass>
</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>DFSRServiceDiscovery2003.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><Script>Option Explicit

On Error Resume Next

Dim SourceType, SourceID, ManagedEntityId, oArgs, oAPI, sDfsrServerName, isVirtualNode

SetLocale("en-us")

Set oAPI = CreateObject("MOM.ScriptAPI")
Set oArgs = WScript.Arguments

if oArgs.Count &lt; 4 Then
call oAPI.LogScriptEvent("DFSRServiceDiscovery2003.vbs", 100, 1, "Expected 4 or 5 arguments. There were only " &amp; oArgs.Count &amp; " arguments. Exiting script.")
Wscript.Quit -1
End If

Dim oDiscData, oDfsService, oServiceConfig, oDfsrInfo, StateStr, oServiceConfigCollection, oDfsrInfoCollection, oDfsrConfig, oDfsrConfigCollection
Dim CurrentTime, colItems, objItem, numUptMins, numUptHour, strMsg, numUptime, serviceState

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

serviceState = "NOT KNOWN"

set oDiscData = oAPI.CreateDiscoveryData(SourceType, SourceId, ManagedEntityId)

Dim oDfsrSvc, oSvcCollection, objWMIService, oServiceWMI

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &amp; sDfsrServerName &amp; "\root\cimv2")
if Err.Number &lt;&gt; 0 then
strErr = "Unable to connect to local cimv2 WMI provider. Error: 0x" &amp; Hex(Err.Number) &amp; " " &amp; Err.Description
WScript.Echo strErr
Wscript.Quit -1
End If

Set oSvcCollection = objWMIService.ExecQuery ("Select State from Win32_service Where Name = 'DFSR'")
if Err.Number &lt;&gt; 0 then
strErr = "Unable to query Win32_service from local cimv2 WMI provider. Error: 0x" &amp; Hex(Err.Number) &amp; " " &amp; Err.Description
WScript.Echo strErr
Wscript.Quit -1
End If

set oDfsService = oDiscData.CreateClassInstance("$MPElement[Name='Microsoft.Windows.FileServer.DFSR.2003.Service']$")

call oDfsService.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", sDfsrServerName)
call oDfsService.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", Left(sDfsrServerName, InStr(sDfsrServerName, ".")-1))
call oDfsService.AddProperty("$MPElement[Name='DFSRLib!Microsoft.Windows.FileServer.DFSR.Service']/IsVirtualNode$", isVirtualNode)
call oDfsService.AddProperty("$MPElement[Name='DFSRLib!Microsoft.Windows.FileServer.DFSR.Service']/IsRoDriverLoaded$", "N/A")

for each oDfsrSvc in oSvcCollection
serviceState = UCase(oDfsrSvc.State)
Next

call oDfsService.AddProperty("$MPElement[Name='DFSRLib!Microsoft.Windows.FileServer.DFSR.Service']/State$", serviceState)

If serviceState = "RUNNING" Then

Set oServiceWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &amp; sDfsrServerName &amp; "\root\microsoftdfs")
if Err.Number &lt;&gt; 0 then
strErr = "Unable to connect to local DFSR WMI provider. Error: 0x" &amp; Hex(Err.Number) &amp; " " &amp; Err.Description
WScript.Echo strErr
Wscript.Quit -1
End If

Set oServiceConfigCollection = oServiceWMI.ExecQuery ("Select ConflictHighWatermarkPercent, ConflictLowWatermarkPercent, StagingHighWatermarkPercent, StagingLowWatermarkPercent, DebugLogFilePath from DfsrMachineConfig")
if Err.Number &lt;&gt; 0 then
strErr = "Unable to query DfsrMachineConfig from local DFSR WMI provider. Error: 0x" &amp; Hex(Err.Number) &amp; " " &amp; Err.Description
WScript.Echo strErr
Wscript.Quit -1
End If

for each oServiceConfig in oServiceConfigCollection

call oDfsService.AddProperty("$MPElement[Name='DFSRLib!Microsoft.Windows.FileServer.DFSR.Service']/ConflictHighWatermarkPercent$", oServiceConfig.ConflictHighWatermarkPercent)
call oDfsService.AddProperty("$MPElement[Name='DFSRLib!Microsoft.Windows.FileServer.DFSR.Service']/ConflictLowWatermarkPercent$", oServiceConfig.ConflictLowWatermarkPercent)
call oDfsService.AddProperty("$MPElement[Name='DFSRLib!Microsoft.Windows.FileServer.DFSR.Service']/StagingHighWatermarkPercent$", oServiceConfig.StagingHighWatermarkPercent)
call oDfsService.AddProperty("$MPElement[Name='DFSRLib!Microsoft.Windows.FileServer.DFSR.Service']/StagingLowWatermarkPercent$", oServiceConfig.StagingLowWatermarkPercent)
call oDfsService.AddProperty("$MPElement[Name='DFSRLib!Microsoft.Windows.FileServer.DFSR.Service']/DebugLogFilePath$", oServiceConfig.DebugLogFilePath)

Exit For
Next
End If

Call oDiscData.AddInstance(oDfsService)

Call oAPI.Return(oDiscData)</Script></ScriptBody>
<TimeoutSeconds>900</TimeoutSeconds>
</DataSource>
</Discovery>