how can i target instances of classes which i discovered using powershell scriot?
param($sourceId,$managedEntityId,$computerName,$RESTService)
$api= New-Object -ComObject 'MOM.ScriptAPI'
$discoveryData=$api.CreateDiscoveryData(0,$sourceId,$managedEntityId)
$proxy = Invoke-RestMethod -Uri $RESTService
foreach($subFolder in $proxy.ArrayOfResources.Resources)
{
$instance=$discoveryData.CreateClassInstance("$MPElement[Name='SystemPulseKS.RestService.Resources']$")
$instance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$",$computerName)
$instance.AddProperty("$MPElement[Name='SystemPulseKS.RestService.Resources']/ResourceName$",$subFolder.ResName)
$instance.AddProperty("$MPElement[Name='SystemPulseKS.RestService.Resources']/ResGroup$",$subFolder.ResGroup)

$discoveryData.AddInstance($instance)
}
#$api.Return($discoveryData)
$discoveryData
here is my powershell discovery script,it is running like a charm but how can I target those instances of class SystemPulseKS.RestService.Resources,So that I can add some monitoring data to those instances like monitors rule
February 9th, 2015 2:47am

From the SCOM console, you can select your class when you create a new rule or monitor (but you need to save this new rule/monitor to the same MP as the discovery, if it's unsealed).

From a text editor, just put Target="My.Discovered.Class" on your monitor/rule definition, for example

      <UnitMonitor ID="My.Test.Monitor" Accessibility="Public" Enabled="true" Target="My.Discovered.Class" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="Windows!Microsoft.Windows.CheckNTServiceStateMonitorType" ConfirmDelivery="false">
< blah blah blah />
</UnitMonitor>

Free Windows Admin Tool Kit Click here and download it now
February 9th, 2015 5:47am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics