Discovery Script is not working
I am trying to implement a discovery script as provided in http://msdn.microsoft.com/en-us/library/ff400200.aspx Just changed the name: <ClassType ID="xxx.Samples.ScriptDiscovery.TheApplication" Abstract="false" Accessibility="Internal" Hosted="true" Base="Windows!Microsoft.Windows.LocalApplication"> <Property ID="Version" Type="string"/> <Property ID="Path" Type="string"/> </ClassType> ... <Discovery ID="xxx.Samples.ScriptDiscovery.TheApplication.Discovery" Target="Windows!Microsoft.Windows.Server.Computer" Remotable="false" Enabled="true"> <Category>Discovery</Category> <DiscoveryTypes> <DiscoveryClass TypeID="xxx.Samples.ScriptDiscovery.TheApplication"> <Property PropertyID="Version"/> <Property PropertyID="Path"/> <Property TypeID="System!System.Entity" PropertyID="DisplayName"/> </DiscoveryClass> </DiscoveryTypes> <DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedScript.DiscoveryProvider"> <IntervalSeconds>3600</IntervalSeconds> <SyncTime/> <ScriptName>Microsoft.Samples.DiscoverApp.vbs</ScriptName> <Arguments>$MPElement$ $Target/Id$ $Target/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Arguments> <ScriptBody> <![CDATA[ Option Explicit Dim oArgs Set oArgs = WScript.Arguments if oArgs.Count < 3 Then Wscript.Quit -1 End If Dim SourceID, ManagedEntityId, TargetComputer SourceId = oArgs(0) ManagedEntityId = oArgs(1) TargetComputer = oArgs(2) Dim oFso Set oFso = CreateObject("Scripting.FileSystemObject") Dim oAPI, oDiscoveryData, oInst Set oAPI = CreateObject("MOM.ScriptAPI") set oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId) set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='xxx.Samples.ScriptDiscovery.TheApplication']$") call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", TargetComputer) call oInst.AddProperty("$MPElement[Name='xxx.Samples.ScriptDiscovery.TheApplication']/Version$", "2.0") call oInst.AddProperty("$MPElement[Name='xxx.Samples.ScriptDiscovery.TheApplication']/Path$", "C:\Microsoft\Samples\Modules") call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "TheApplication") call oDiscoveryData.AddInstance(oInst) Call oAPI.Return(oDiscoveryData) ]]> </ScriptBody> <TimeoutSeconds>20</TimeoutSeconds> </DataSource> </Discovery> ... Imported the management pack all well - no errors in th eevent log... but the instance is not discovered... I went in with the workflow analyzer here is the output: 7/6/2011 1:06:35 PM SchedulerDataSource Initialize Starting State: <null> 7/6/2011 1:06:41 PM BatchResponse StopProcessing Process with command line '"C:\WINDOWS\system32\cscript.exe" /nologo "Microsoft.Samples.DiscoverApp.vbs" {F9C07784-0A94-1365-CAE9-FBEECEC8E20D} {B1774301-36E0-0266-5509-E3D1DC7D8F64} davos.PROTEC.COM' returned StdOut: <DataItem type="System.DiscoveryData" time="2011-07-06T13:06:41.2516625-07:00" sourceHealthServiceId="A198AC0B-4420-BCFF-0AF0-44F155E45288"><DiscoveryType>0</DiscoveryType><DiscoverySourceType>0</DiscoverySourceType><DiscoverySourceObjectId>{F9C07784-0A94-1365-CAE9-FBEECEC8E20D}</DiscoverySourceObjectId><DiscoverySourceManagedEntity>{B1774301-36E0-0266-5509-E3D1DC7D8F64}</DiscoverySourceManagedEntity><ClassInstances><ClassInstance TypeId="{BC300A9F-E012-9D96-000B-9856FCB88E3B}"><Settings><Setting><Name>{5C324096-D928-76DB-E9E7-E629DCC261B1}</Name><Value>davos.PROTEC.COM</Value></Setting><Setting><Name>{5B958FA4-2DDF-6B23-A0EB-9D9E93A3CD44}</Name><Value>2.0</Value></Setting><Setting><Name>{236FDE24-E367-692F-63A3-5D44FE6ADDBF}</Name><Value>C:\Microsoft\Samples\Modules</Value></Setting><Setting><Name>{AFB4F9E6-BF48-1737-76AD-C9B3EC325B97}</Name><Value>TheApplication</Value></Setting></Settings></ClassInstance></ClassInstances></DataItem> StdErr:NULL ExitCode:0 7/6/2011 1:06:41 PM BatchResponse IModuleHost->PostOutputDataItems Posting Logical Set of 1 DataItems 7/6/2011 1:06:41 PM BatchResponse IModuleHost->PostOutputDataItems succeeded 7/6/2011 1:06:41 PM DiscoveryFilter OnNewDataItems New Logical Set of 1 DataItems delivered on port 0, completion callback 00000000 context 00000000 7/6/2011 1:06:41 PM DiscoveryFilter OnNewDataItems Recieved DataItem <DataItem type="System.DiscoveryData" time="2011-07-06T13:06:41.2516625-07:00" sourceHealthServiceId="A198AC0B-4420-BCFF-0AF0-44F155E45288"><DiscoveryType>0</DiscoveryType><DiscoverySourceType>0</DiscoverySourceType><DiscoverySourceObjectId>{F9C07784-0A94-1365-CAE9-FBEECEC8E20D}</DiscoverySourceObjectId><DiscoverySourceManagedEntity>{B1774301-36E0-0266-5509-E3D1DC7D8F64}</DiscoverySourceManagedEntity><ClassInstances><ClassInstance TypeId="{BC300A9F-E012-9D96-000B-9856FCB88E3B}"><Settings><Setting><Name>{5C324096-D928-76DB-E9E7-E629DCC261B1}</Name><Value>davos.PROTEC.COM</Value></Setting><Setting><Name>{5B958FA4-2DDF-6B23-A0EB-9D9E93A3CD44}</Name><Value>2.0</Value></Setting><Setting><Name>{236FDE24-E367-692F-63A3-5D44FE6ADDBF}</Name><Value>C:\Microsoft\Samples\Modules</Value></Setting><Setting><Name>{AFB4F9E6-BF48-1737-76AD-C9B3EC325B97}</Name><Value>TheApplication</Value></Setting></Settings></ClassInstance></ClassInstances></DataItem> Any ideas what is wrong with it? Thanks! David
July 6th, 2011 4:20pm

It looks like it took several hours to show up but I do see the object discovered when I open a Diagram View for the "Windows Computer" (the object is hosted in it). Does not show though in the "Discovered Inventory" view ... The bottom line - it is working...
Free Windows Admin Tool Kit Click here and download it now
July 7th, 2011 4:52pm

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

Other recent topics Other recent topics