File Services DFS Relationship Discovery (Windows Server 2008 R2)

Microsoft.Windows.FileServer.DFSN.2008R2.FileServerRelationDiscovery (Discovery)

This rule creates a relationship between the File Services Role for Windows Server 2008 R2 class and the DFS Namespaces Role Service (Windows Server 2008 R2) class. It does so by running the DFSN2008R2FileServerRoleDiscovery.vbs script.

Knowledge Base article:

Summary

This rule creates a relationship between the File Services Role for Windows Server 2008 R2 class and the DFS Namespaces Role Service (Windows Server 2008 R2) class.

Configuration

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

Element properties:

TargetMicrosoft.Windows.FileServer.2008R2
EnabledTrue
Frequency43200
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:
Discovered relationships and their attribuets:

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource Microsoft.Windows.TimedScript.DiscoveryProvider Microsoft.Windows.FileServer.DFSN.NamespaceDiscoveryAccount

Source Code:

<Discovery ID="Microsoft.Windows.FileServer.DFSN.2008R2.FileServerRelationDiscovery" Enabled="true" Target="FileServices2008R2!Microsoft.Windows.FileServer.2008R2" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="FileServices2008R2!Microsoft.Windows.FileServer.2008R2"/>
<DiscoveryClass TypeID="Microsoft.Windows.FileServer.DFSN.2008R2.RoleService"/>
<DiscoveryRelationship TypeID="FileServices!Microsoft.Windows.FileServer.Contains.Service"/>
</DiscoveryTypes>
<DataSource ID="DS" RunAs="DFSNLib!Microsoft.Windows.FileServer.DFSN.NamespaceDiscoveryAccount" TypeID="Windows!Microsoft.Windows.TimedScript.DiscoveryProvider">
<IntervalSeconds>43200</IntervalSeconds>
<SyncTime/>
<ScriptName>DFSN2008R2FileServerRoleDiscovery.vbs</ScriptName>
<Arguments>$MPElement$ $Target/Id$ $Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$ $Target/Property[Type="FileServices!Microsoft.Windows.FileServer"]/IsOnVirtualNode$</Arguments>
<ScriptBody><Script>Option Explicit
On Error Resume Next
SetLocale("en-us")
Dim oAPI, oArgs
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; 3 Then
Wscript.Quit -1
End If

Dim SourceID, ManagedEntityId, TargetComputer, IsVirtualNode

SourceId = oArgs(0)
ManagedEntityId = oArgs(1)
TargetComputer = oArgs(2)
IsVirtualNode = "false"

if oArgs.Count &gt; 3 Then
IsVirtualNode = oArgs(3)
End If

Dim oDiscoveryData, oInst, oRel, OInstFs

set oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)
If Err.Number &lt;&gt; 0 Then
Wscript.Quit -1
End if

Dim oWmiInst, oDfsService
Set oWmiInst = GetObject("winmgmts:\\" &amp; TargetComputer &amp; "\ROOT\CIMV2")
If Err.Number &lt;&gt; 0 Then
Wscript.Quit -1
End if
Set oDfsService = oWmiInst.ExecQuery("SELECT * FROM Win32_Service WHERE Name='dfs'")

if oDfsService.Count &gt; 0 Then
set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Microsoft.Windows.FileServer.DFSN.2008R2.RoleService']$")

call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", TargetComputer)
call oInst.AddProperty("$MPElement[Name='DFSNLib!Microsoft.Windows.FileServer.DFSN.RoleService']/IsOnVirtualNode$", IsVirtualNode)
call oDiscoveryData.AddInstance(oInst)

''
'' Since we are using "contains" - we have to now discover the class instance above us. If it is
'' already discovered, Ops Manager will recognize this as a reference count increase and not a
'' separate discovery because the key property is the same.
''

set oInstFs = oDiscoveryData.CreateClassInstance("$MPElement[Name='FileServices2008R2!Microsoft.Windows.FileServer.2008R2']$")
call oInstFs.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", TargetComputer)
call oDiscoveryData.AddInstance(oInstFs)

''
'' Now we have to also create an instance of the relationship to link this Service instance to its parent (FileServer)
''

Set oRel = oDiscoveryData.CreateRelationshipInstance("$MPElement[Name='FileServices!Microsoft.Windows.FileServer.Contains.Service']$")
oRel.Source = oInstFs
oRel.Target = oInst
Call oDiscoveryData.AddInstance(oRel)
End If

Call oAPI.Return(oDiscoveryData)</Script></ScriptBody>
<TimeoutSeconds>300</TimeoutSeconds>
</DataSource>
</Discovery>