There are a number of scenarios where you want to fail your runbook

and make sure that the runbook status is “failed”

this could, for instance be

  • Triggering runbook from service manager, or other external system which checks the result
  • Triggering from PowerShell
  • If you want to use the statistics properly in orchestrator.

There is one rule that decides if the runbook status is success,warning or failed.

Success = All Activities is success full

Warning = One or more activities has failed or warning

Failed = Last activity that executes has status failed.

The challenge is that many “failures” in runbooks, are logical errors, which the runbook does not know is an error

Examples:

  • Searching for Service Request. Nothing found
    • Runbook see it as success, since the search was made
    • but we think it is a failure because we did not find what we needed
  • Proper logging is implemented
    • the last activity will be the logging activity, which is successful = runbook status: Success.
    • to make it fail, we cant to insert an error after the logging activity.

 

How to do it:

  1. Add a Run .Net Script activity to the work space
  2. Use the following script to output the error:

This means you runbook might look similar to this:

 

image

The above pictures shows an example of a Service Manager runbook, that i used in my session som NIC 2014.

Get the slides and runbook here