System Center 2012 Orchestrator – RunBook Activities
In this second part of Orchestrator RunBook Concepts series, we’ll cover RunBook activities and its properties.
For the part 1: http://social.technet.microsoft.com/wiki/contents/articles/7982.system-center-2012-orchestrator-runbook-basics.aspx
In the System Center 2012 Orchestrator , activities are the building blocks of RunBooks. In general, individual activities perform three actions:
- Access Published Data.
- Perform some action.
- Publish new data.
By default installation, Orchestrator has following activity collections.
http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-79-57-metablogapi/1157.image_5F00_thumb_5F00_10B16278.png
Each collection includes custom activities.
http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-79-57-metablogapi/5344.image_5F00_thumb_5F00_27DC1B4F.png
Other that Orchestrator provides you to extend standard activities with;
- Integration Packs
- Orchestrator Integration Toolkit
IP’s are Microsoft or third-party products that contain additional activities for a specific technology. For example Service Manager 2012, Configuration Manager 2012 or HP.
If required functionality is not available in an IP, then you can use OIK to build custom activity. Orchestrator CodepPlex page http://orchestrator.codeplex.com/ includes custom integration packs that was built with OIK.
We’ll cover about how you can import an IP or how you can create your own IP with OIK in the next posts in this series.
Now lets look at the properties of an activity.
GENERAL:
http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-79-57-metablogapi/2604.image_5F00_thumb_5F00_55F5CB6F.png
General tab allows you to set a custom name and description for each activity.
Published Data:
http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-79-57-metablogapi/1205.image_5F00_thumb_5F00_05DFD157.png
Orchestrator lets you to get data from published data items and convert them into a usable form. For example you can read a text file line by line and publish each line text to the other activities or RunBooks.
http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-79-57-metablogapi/4401.image_5F00_thumb_5F00_64BCAEEF.png
For the above example, I used Read Line activity to read each line in a text file. Next activity is responsible to start/stop specific services on remote machines.
Now open Start/Stop Services activity details tab;
http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-79-57-metablogapi/3056.image_5F00_thumb_5F00_663D095C.png
http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-79-57-metablogapi/0207.image_5F00_thumb_5F00_5FD5E734.png
By default read line activity publishes above data into the Orchestrator Databus.
In Start/Stop Service activity if you right click any field and click Subscribe, each published data for previously linked activities will be shown up. “Line text” is what I want exactly to get right computer names to start/stop relevant service.
Same process also can be used for .Net Script activity.
http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-79-57-metablogapi/7217.image_5F00_thumb_5F00_4016E79F.png
By default .Net Script activity does not publish any data into the Orchestrator Databus. But you can optionally publish each PowerShell variable with a few clicks.
http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-79-57-metablogapi/6138.image_5F00_thumb_5F00_4CE117F0.png
$explorerprocess = Get-Process | where {$_.name -like "iexplore"} | select ID
command gets all processes that name column includes “iexplore” string and then pipe out only ID information. I assigned each ID’s to a variable called $explorerprocess. This is not a useful or well designed script but our purpose is to show how to publish variables within a PowerShell scripts to the Orchestrator Databus.
Now I can define this variable as a Published Data in Run .Net Script activity.
http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-79-57-metablogapi/6523.image_5F00_thumb_5F00_09A573F6.png
Simply give a name and enter your exact variable name. I used same for both field as you see.
http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-79-57-metablogapi/1856.image_5F00_thumb_5F00_4AE050C2.png
Now open Append Line Activity details.
http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-79-57-metablogapi/6305.image_5F00_thumb_5F00_7111C2A6.png
You can now use previously Published variable.
http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-79-57-metablogapi/0842.image_5F00_thumb_5F00_7C2B2723.png
http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-79-57-metablogapi/7838.image_5F00_thumb_5F00_68F9D4AA.png
If you run your Runbook it will get all Explorer process id’s and append them in to the text file line by line.
http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-79-57-metablogapi/3323.image_5F00_thumb_5F00_5AAB35ED.png
Of course you can modify your PowerShell script to get better looking outputs.
Published Data Behavior:
This tab contains the properties that determine how the activity handles multi-value Published Data.
http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-79-57-metablogapi/1614.image_5F00_thumb_5F00_305B3C6B.png
http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-79-57-metablogapi/2248.image_5F00_thumb_5F00_177BA3C1.png
If we would configure Run behavior as “Separate With ,” for the previous example, we would have below output.
http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-79-57-metablogapi/6457.image_5F00_thumb_5F00_0F73DB92.png
Security Credentials.
This tab allows you to specify other accounts than RunBook Server Service account. This helps you when activity performs actions on remote computers.
http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-79-57-metablogapi/2816.image_5F00_thumb_5F00_1DDEB1EA.png
Next part we’ll cover how to run or test your RunBooks.