Server Discovery for Windows Server 2008 R2

Microsoft.Windows.FileServer.Service.SMB.2008R2.Discovery (Discovery)

This object discovers the Server service on computers running Windows Server 2008 R2.

Knowledge Base article:

Summary

This object discovers all instances of the Server service on computers running Windows Server 2008 R2 that have the File Services role installed.

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.FileServices.MonitoringAccount

Source Code:

<Discovery ID="Microsoft.Windows.FileServer.Service.SMB.2008R2.Discovery" Enabled="true" Target="FileServicesR2!Microsoft.Windows.FileServer.2008R2" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Microsoft.Windows.FileServer.Service.SMB.2008R2"/>
<DiscoveryRelationship TypeID="FileServices!Microsoft.Windows.FileServer.Contains.Service"/>
</DiscoveryTypes>
<DataSource ID="DS" RunAs="FileServices!Microsoft.Windows.FileServices.MonitoringAccount" TypeID="Windows!Microsoft.Windows.TimedScript.DiscoveryProvider">
<IntervalSeconds>43200</IntervalSeconds>
<SyncTime/>
<ScriptName>DiscoverSMB.vbs</ScriptName>
<Arguments>$MPElement$ $Target/Id$ $Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Arguments>
<ScriptBody><Script>
Option Explicit

SetLocale("en-us")

Dim oAPI, oArgs
Set oAPI = CreateObject("MOM.ScriptAPI")

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

Dim SourceID, ManagedEntityId, TargetComputer

SourceId = oArgs(0)
ManagedEntityId = oArgs(1)
TargetComputer = oArgs(2)

Dim oDiscoveryData, oInst, oRel, OInstFs
set oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)

set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Microsoft.Windows.FileServer.Service.SMB.2008R2']$")
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", TargetComputer)
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", Left(TargetComputer, InStr(TargetComputer, ".")-1))
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='FileServicesR2!Microsoft.Windows.FileServer.2008R2']$")
call oInstFs.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", TargetComputer)
call oInstFs.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", Left(TargetComputer, InStr(TargetComputer, ".")-1))
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)

Call oAPI.Return(oDiscoveryData)

</Script></ScriptBody>
<TimeoutSeconds>300</TimeoutSeconds>
</DataSource>
</Discovery>