System Center Orchestrator SQL Query–Get Parent Caller Runbook

In huge System Center Orchestrator Environments, it is usual to make a lot of Sub Runbooks, that will be called by more than one Parent Runbook.

For Example, you build a Runbook to add a User in a Group. This Runbook will definitely be used by different Parent Runbooks. And in this case, it can sometimes be useful to query all Runbooks, which are calling our “Add User to Group” Runbook.

So, without any longer explanation, here is the SQL Query, which need to be run against the Orchestrator DB.

Don’t forget to change the Name of the Runbook, you want to query, at the End of the Script, in our example the name is “1.1-AddUserToGroup”

SQL Query

use Orchestrator

SELECT
[Caller Runbook].Name AS [Caller Runbook Name],
[Caller Runbook].Path AS [Caller Runbook Path],
[Called Runbook].Name AS [Called Runbook Name],
[Called Runbook].Path AS [Called Runbook Path], 
[Microsoft.SystemCenter.Orchestrator].Activities.Name AS [Activity Name]
FROM
[Microsoft.SystemCenter.Orchestrator].Activities INNER JOIN
dbo.TRIGGER_POLICY ON [Microsoft.SystemCenter.Orchestrator].Activities.Id = dbo.TRIGGER_POLICY.UniqueID INNER JOIN
[Microsoft.SystemCenter.Orchestrator].Runbooks AS [Called Runbook] ON dbo.TRIGGER_POLICY.PolicyObjectID = [Called Runbook].Id INNER JOIN
[Microsoft.SystemCenter.Orchestrator].Runbooks AS [Caller Runbook] ON [Microsoft.SystemCenter.Orchestrator].Activities.RunbookId = [Caller Runbook].Id
where [Called Runbook].Name = '1.1-Reset PW'

Michael Seidl aka Techguy

Leave a Comment

Your email address will not be published. Required fields are marked *

*