SCOM Trigger On Demand Discovery - DISCOVERY_NOT_FOUND

1.8k views Asked by At

I am trying to use PowerShell Script in a management pack I am creating to trigger discovery automatically.

I try using the PowerShell script described here in link:

Task Result/Output Discovery_not_found SCOM

TaskId               : ff34dc4f-2db3-1736-d9f2-6d85b539ff96
BatchId              : 53d9f71a-a3ce-494f-9536-cc2443d6fb1d
SubmittedBy          : dev2\administrator
RunningAs            : 
TargetObjectId       : 6904f683-999f-ae14-5be7-fef74d1e5596
TargetClassId        : ab4c891f-3359-3fb6-0704-075fbfe36710
LocationId           : 6904f683-999f-ae14-5be7-fef74d1e5596
Status               : Succeeded
Output               : <DataItem type="System.OnDemandDiscoveryResponse" time="2013-08-16T11:36:10.9682547-07:00" sourceHealthServiceId="6904F683-999F-AE14-5BE7-FEF74D1E5596"><Result>DISCOVERY_NOT_FOUND</Result><Timestamp></Timesta
                       mp></DataItem>
ErrorCode            : 0

I tried the Operations Console Task and I get the same result as shown by the image.

NOTE I pass in the GUID of the Discovery I have. I tried keeping Target Id as $Target/Id$ and also changing it to GUID of target class that my discovery runs on. Both gave same result below.

1

There are 1 answers

0
ArunasT On

Discoveries can run on SCOM Management Server/Gateway or Agent. Michel's sample discovery is run on Management server. Most discoveries will run on the agent, if this is the case you need to change the class to "Microsoft.SystemCenter.Agent". Replace this line:

$instance=get-scomclass -name Microsoft.SystemCenter.ManagementServer | get-
scomclassinstance | ?{$_.displayname -eq $Omserver}

with this:

$instance = get-scomclass -name Microsoft.SystemCenter.Agent | get-
scomclassinstance | ?{$_.displayname -eq $TargetDisplayName}