Finding Unused Runbooks in System Center Orchestrator
By Steve Bowman
Published January 21, 2015
Estimated Reading Time: < 1 minutes

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].[dbo].[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].[dbo].[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!

Article By Steve Bowman
Steve Bowman is a Partner at Model Technology as well as their Vice President of Sales and Marketing. Steve is a father, husband, Franciscan, and lover of technology. He's bilingual in business and technology and have over 30 years of experience in selling enterprise technology solutions in a variety of industries.

Related Posts

No more cyber insurance forms!

Tired of filling out endless cyber insurance forms?

  • Download accurate security reports about your environment with a single click.
  • Avoid costly reporting errors.
  • Use your time in better ways.
  • Prove your cyber readiness with confidence.

Download our vCISO platform brochure to learn more.