Set oAPI = CreateObject("MOM.ScriptAPI")
Set oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)
Set oMMSchedulerEventCollector = oDiscoveryData.CreateClassInstance("$MPElement[Name='SCOM2012.Maintenance.Mode.Scheduler.Monitoring.EventCollector']$")
oMMSchedulerEventCollector.AddProperty "$MPElement[Name='SCOM2012.Maintenance.Mode.Scheduler.Monitoring.EventCollector']/CollectorName$", sComputerName
oDiscoveryData.AddInstance(oMMSchedulerEventCollector)
'Create an instance of the health service class.
Set oHealthServiceInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='SC!Microsoft.SystemCenter.HealthService']$")
oHealthServiceInstance.AddProperty "$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", sComputerName
oDiscoveryData.AddInstance oHealthServiceInstance
'Create the relationship and add to the discovery data.
set oShouldManageInstance = oDiscoveryData.CreateRelationshipInstance("$MPElement[Name='SC!Microsoft.SystemCenter.HealthServiceShouldManageEntity']$")
oShouldManageInstance.Source = oHealthServiceInstance
oShouldManageInstance.Target = oMMSchedulerEventCollector
oDiscoveryData.AddInstance oShouldManageInstance
'Return the discovery data.
oAPI.Return(oDiscoveryData) </Script></ScriptBody>
<TimeoutSeconds>60</TimeoutSeconds>
</DataSource>
</Discovery>