Building a better Orchestrator Runbook testing tool

Orchestrator

The Story

I recently started working on a project that required me to create a lot of System Center Orchestrator Runbooks. I quickly became frustrated with the Runbook Tester application because it would only run while a runbook is checked out, rendering the runbook useless for colleagues that needed it. Also the application would run under your current account instead of the orchestrator service account so I couldn’t trust it’s results (I know I can log in under that account but the point is: I really shouldn’t have to). I then switched to the Orchestrator Console to test the runbooks. This takes care of all of the issues above but was still frustrating to test with for the following reason: everytime I start a runbook I have to manualy enter all the parameters. The more input parameters your runbook has, the longer it takes to test it. And then if I test the runbook and it fails within ten seconds I have to start all over again! Say it with me, folks: frustrating!

After a few days of self-pity and blaming Microsoft for my sorrows I thought to myself: If you can’t get the proper tools for the product, build one yourself! So I went to my favorite Powershell tool: Sapien Powershell Studio. I used some Microsoft MSDN pages to create my own set of functions to utilize the orchestrator web service, only to find out after the fact that someone else had build a cool module for it (check out this codeplex site). Then I build a GUI around it. I think its my best work yet!

The Plan

Here’s what I wanted my tool to do:

  • Get a list of runbooks to choose from.
  • Remember the last runbook that was run from the tool.
  • Get a list of parameters for the chosen runbook.
  • Enter all the parameter values that were last used.
  • Get a list of runbook servers to start the runbook on.
  • Save a runbooks values in a XML file for later use.
  • Start the runbook and (optionally) open the appropriate details page to monitor progress.
  • Delete saved parameters if the parameter was removed from the runbook.

The end result

And here it is for your viewing pleasure:

Main Form

The first time the tool launches it will ask you to configure your web service setings. This form looks like this:

ConfigForm

You can either use your current credentials or provide alternate  ones. Once the test passes you’ll be able to click OK and go to the main form. Once you pick a runbook from the dropdown list the input parameters are loaded into the datagridview box. You can enter the values and use TAB to navigate through them. Once you’ve selected a runbook server you’ll be able to click the Run button and off you go!

All settings and values will be saved in the current user registry (HKCU:\Software\MicaH\Orchestrator Tool). The password will be encrypted. You can use the menu bar to open or save values to a XML file and edit your webservice configuration. Standard shortcuts are also available (Ctrl + S, Ctrl + O, etc.). The Refresh All button refreshes all the available runbooks (in case you create a new one) while the Refresh Current button only refreshes the runbook you’ve selected. This comes in handy if you add an input parameter to your runbook and don’t want to close and reopen the application.

 Care Package

The tool can be downloaded here:

Orchestrator Runbook Test Tool v 1.0

The tool has only been tested on a MS Windows 2012 R2 server but should work on other Microsoft operating systems (as long as DotNet and powershell are present). If you download it and find it to be useful, please leave a comment. Also, please report back if you find a bug or if you have idea’s on how to improve the tool.

Enjoy!

MicaH

Version History:

1.0.0.2 - Fixed the forms resizing capabilities.

1.0.0.1 - Fixed a bug where the outgoing parameters were also displayed.

1.0.0.0 - Initial version
Advertisements

About MicaH

I'm a Technical Specialist at PepperByte BV (the Netherlands).
This entry was posted in Powershell, Sapien Powershell Studio and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s