AppSense PM 8 Agent Discovery

AppSense.PM.8.Agent.Discovery (Discovery)

Discovery Class to discover all instances of the AppSense PM Agent 8.x installed on Windows computers within the scope of the System Center Operations Manager 2007 Management Group.

Knowledge Base article:

Summary

AppSense PM 8 Agent Discovery

Discovery Class to discover all instances of the AppSense PM Agent 8.x installed on Windows computers within the scope of the System Center Operations Manager 2007 Management Group.

Causes

Resolutions

Element properties:

TargetMicrosoft.Windows.Computer
EnabledTrue
Frequency86400
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:

Member Modules:

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

Source Code:

<Discovery ID="AppSense.PM.8.Agent.Discovery" Enabled="true" Target="Windows!Microsoft.Windows.Computer" ConfirmDelivery="true" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="AppSense.PM.8.Agent"/>
</DiscoveryTypes>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedScript.DiscoveryProvider">
<IntervalSeconds>86400</IntervalSeconds>
<SyncTime/>
<ScriptName>AgentService.vbs</ScriptName>
<Arguments>$MPElement$ $Target/Id$ $Target/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Arguments>
<ScriptBody><Script>const HKEY_LOCAL_MACHINE = &amp;H80000002

SetLocale("en-us")
Dim oArgs
Set oArgs = WScript.Arguments
Dim SourceId, ManagedEntityId, targetComputer
' SourceId is the GUID of the discovery object that runs the script.
SourceId = oArgs(0)
' ManagedEntityId is the GUID of the computer class that is targeted by the script.
ManagedEntityId = oArgs(1)
' targetComputer is the Fully Qualified Domain Name
' of the computer targeted by the script. The FQDN
' is in Arg(2) of the command prompt.
targetComputer = oArgs(2)

Dim oAPI
Set oApi = CreateObject("MOM.ScriptAPI")

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

set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &amp; targetComputer &amp; "\root\cimv2")
set items = objWMIService.ExecQuery("select Name, Version from win32_product where NAME like 'AppSense Performance Manager Agent% 8%'")
If IsNull(items) = false And items.Count &gt; 0 Then
' Create the application instance.
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='AppSense.PM.8.Agent']$")

For Each item in items
' Define the property values.
Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", targetComputer)
Call oInst.AddProperty("$MPElement[Name='AppSense.PM.8.Agent']/ProductName$", item.Name)
Call oInst.AddProperty("$MPElement[Name='AppSense.PM.8.Agent']/ProductVersion$", item.Version)
Next

oDiscoveryData.AddInstance(oInst)
End If
' Submit the discovery data to the Operations Manager database.
oAPI.Return(oDiscoveryData)</Script></ScriptBody>
<TimeoutSeconds>301</TimeoutSeconds>
</DataSource>
</Discovery>