Create Runbook activities from Orchestrator

September 16, 2013 Posted by Anders Asp

Have you tried adding Runbook Activities to your Service Requests dynamic through Orchestrator? Depending on the information provided by the end user on the self-service portal you might want to automate different things or in different ways. So the idea here is to have a Service Request template containing one initial Runbook Activity that adds the rest of the activities to the actual Service Request, whether it’s Manual, Review or Runbook Activities.

Creating/addning Manual or Review activities through Orchestrator isn’t that complicated, as long as you remember to set some essential properties, such as Sequence ID or adding the prefix to ID. The challange comes when trying to add Runbook Activities to your Work Item.

Using the same approach as you do when creating Manual or Review Activities, this is how you would do it:

SS1This will create the Runbook Activity in the SR but if you want the Runbook Activity to function properly, you have to set some pretty complex parameters in the configuration of the “Create related RB activity”. It’s simply not manageable.

So how do we solve this? Well, how does it work from the console? When adding an activity to a Work Item, you actually have to select an activity template, and that’s exactly what we are going to do here as well. It’s just that we are going to apply the template to the Runbook Activity after it’s been created.

To do this we need SMLets (http://smlets.codeplex.com/) and the “PS Script Execution” IP for Orchestrator (http://orchestrator.codeplex.com/releases/view/76101). I tend to use this IP to run SMLets on the SCSM mgmt. server when using SMLets from Orchestrator. Install SMLets on your SCSM management server and deploy and configure the “PS Script Execution” IP on your Orchestrator Runbook Server.

Now, let’s add two activities to our runbook – a “Get Object” activity from the SCSM IP to get the RB activity we just created, and a “Execute PS Script – Global” from the “PS Script Execution” IP.

SS2

I won’t go into details on how all activities are configured or used, as I think you already know that (if not, drop me a comment below and I’ll add more details!), but let’s take a closer look at the “Execute PS Script – Global” activity.

ss3

The activity is configured to call my SCSM mgmt. server where I have SMLets installed. The script I’m running to apply a template on the Runbook Activity itself is actually re-used from an earlier blogpost of mine (http://www.scsm.se/?p=239) and works really good. Using the Runbook Activity ID from the “Get RB” activity we can get the actual object using SMLets. Then we are getting the Runbook Automation Activity template by the displayname of the template itself. In this example the displayname of my template is “Runbook test” (due to lack of imagination 🙂 ). That’s the only two thing you have to reconfigure in this script to make it work!

Here’s the complete script for you to copy/paste:


Import-Module Smlets

$Projection = Get-SCSMTypeProjection Microsoft.SystemCenter.Orchestrator.RunbookAutomationActivity.Projection

$RBID = "RUNBOOK ACTIVITY ID FROM DATABUS" $RBObject = get-scsmobjectprojection $projection -filter "Id -eq $RBID"

$template = Get-SCSMObjectTemplate -displayname "Runbook test"

$RBObject.__base.ApplyTemplate($template) $RBObject.__base.Commit()

Remove-Module Smlets

 

9 Responses to Create Runbook activities from Orchestrator

Leave a Reply to Anders Asp Cancel reply

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

*