Anyone who has ever created a script knows that If statements are a cornerstone for error checking and decision points. You can easily check for a null value and redefine the variable with a specific value.
Fast forward to Orchestrator Runbooks. As you have likely seen already or will see at some point, this same logic doesn’t translate natively to Runbook activities.
Consider this scenario:
You create Runbook activity to retrieve an attribute from an AD User. In our example we’ll use the “Get Object Property Values” Activity from the “SCORCH Dev – Active Directory” IP (available on CodePlex) to retrieve the “DisplayName” property of a User:
What if that attribute does not contain a value? What if you would like to check for a Null value and create a new Published Data entry for DisplayName that has a value of “Unknown” for example? You could certainly use a link condition to determine if the value was Null, but then what?
There is a fairly simple solution to this utilizing the Run .NET Script activity and Powershell.
Using 2 simple lines of code you simply check the Property Value, if null you set a Powershell variable with your own value:
You then publish the Powershell variable to the Databus using the Published Data tab
Snippet of what the Runbook looks like:
Very simple solution to check for Null values and redefine as needed ensuring you have a value on the databus for future activities. 😉 Would love to hear from others in the comments to see how they accomplish this.
Hope this info provides useful for others!