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.
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.
Target | Microsoft.Windows.Computer |
Enabled | True |
Frequency | 86400 |
Remotable | False |
Discovered Classes and their attribuets: |
---|
ID | Module Type | TypeId | RunAs |
---|---|---|---|
DS | DataSource | Microsoft.Windows.TimedScript.DiscoveryProvider | Default |
<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> const HKEY_LOCAL_MACHINE = &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}!\\" & targetComputer & "\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 > 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) </ScriptBody>
<TimeoutSeconds>301</TimeoutSeconds>
</DataSource>
</Discovery>