If you have been using System Center Orchestrator for any period of time there are chances that you have many different unused runbooks in your environment.  Many organizations will version their runbooks and create new versions of runbooks without removing the old runbooks for fear that they might still be referenced through other runbooks.  I have been working with a customer recently that was afraid to delete their older runbooks because someone else might be using them.  After doing some digging in the Orchestrator database, I came up with a couple of queries that are really helpful in determining if another runbook is referencing an existing runbook.

The first query will return a list of all runbooks that call other runbooks:

SELECT
RB1.Name as 'Runbook Name',
RB1.Path as 'Runbook Path',
ACT.Name as 'Activity Name',
RB2.Name as 'Called Runbook Name',
RB2.Path as 'Called Runbook Path'
FROM [Orchestrator].[Microsoft.SystemCenter.Orchestrator].[Activities] ACT inner join [Orchestrator]..[TRIGGER_POLICY] TPOL on ACT.Id = TPOL.UniqueID
inner join [Orchestrator].[Microsoft.SystemCenter.Orchestrator].[Runbooks] RB1 on RB1.ID = ACT.RunbookId
inner join [Orchestrator].[Microsoft.SystemCenter.Orchestrator].[Runbooks] RB2 on RB2.ID = TPOL.PolicyObjectID
where ACT.TypeName = 'Trigger Policy'

If you wanted to see information about a specific runbook you could easily modify the query as follows:


SELECT
RB1.Name as 'Runbook Name',
RB1.Path as 'Runbook Path',
ACT.Name as 'Activity Name',
RB2.Name as 'Called Runbook Name',
RB2.Path as 'Called Runbook Path'
FROM [Orchestrator].[Microsoft.SystemCenter.Orchestrator].[Activities] ACT inner join [Orchestrator]..[TRIGGER_POLICY] TPOL on ACT.Id = TPOL.UniqueID
inner join [Orchestrator].[Microsoft.SystemCenter.Orchestrator].[Runbooks] RB1 on RB1.ID = ACT.RunbookId
inner join [Orchestrator].[Microsoft.SystemCenter.Orchestrator].[Runbooks] RB2 on RB2.ID = TPOL.PolicyObjectID
where ACT.TypeName = 'Trigger Policy' and RB2.Path = 'Path to your runbook'

These queries should allow you to know what runbook is being used by another and give you the information so you can update the runbooks to point to the new version and decommission (Export and delete) the older versions.

Enjoy!

About the Author: steve bowman

Three Minutes For A More Secure & Efficient Infrastructure

Short and to the point, Steve’s Email Blasts give you endpoint management tips, tricks, and news in three minutes or less email read-time, guaranteed.

Model says no to spam. Privacy Policy

Model Technology Solutions

Model Technology Solutions is a small but mighty band of infrastructure experts. We’ve helped companies in diverse industries to modernize and automate their infrastructures through effectively managing their Microsoft endpoint suite.

With us on your team, you’ll watch your security and compliance go up and your IT team’s costs (and headaches) go down. You’ll relax in knowing that your endpoints will be secure and online when your users need them most. And you’ll finally get back to your most-important tasks.

Model Technology Solutions
12125 Woodcrest Executive Drive, Ste. 204 Creve Coeur, MO 63141

Phone: (314) 254-4138
General Inquiries: model@model-technology.com
Sales and Quotes: sales@model-technology.com