Last week I was working on private cloud solution that included around 50 runbooks. In the end of the development phase we needed to make sure all runbooks was following best practices, including naming convention and design standard. For example all links between activities that had a name including “IF” should be updated to orange color, and all runbooks named “Link” should be updated to green color. As we had a lot of runbooks I was thinking about a quick way to updated them all, instead of manually updating each link. We also wanted to update some activity names based on the configuration.
The answer was a couple of SQL queries
To update all non-deleted (Deleted = 0) runbooks that have black (default) color and named Link (default) to green link color
Update LINKS SET Color=’65280′ WHERE Color = ‘0’ AND UniqueID IN (select uniqueID from OBJECTS WHERE ObjectType = ‘7A65BD17-9532-4D07-A6DA-E0F89FA0203E’ AND Name = ‘Link’ AND Deleted = ‘0’)
As you can see we set the color to 65280,
- Green is 65280
- Black is 0
- Red is 255
- Orange is 4227327
To updated all non-deleted links that have name that contains “warning” to red link color, run
Update LINKS SET Color=’255′ WHERE Color = ‘0’ AND UniqueID IN (select uniqueID from OBJECTS WHERE ObjectType = ‘7A65BD17-9532-4D07-A6DA-E0F89FA0203E’ AND Name like ‘%Warning%’ AND Deleted = ‘0’)
If you want to update link width for all links named “Link” you can run the following query
Update LINKS SET Width=’3′ WHERE UniqueID IN (select uniqueID from OBJECTS WHERE ObjectType = ‘7A65BD17-9532-4D07-A6DA-E0F89FA0203E’ AND Name = ‘Link’ AND Deleted = ‘0’)
If you want to update all Invoke Runbook activities with a name starting with “Invoke”, and set the name to the runbook it invoke you can run the following query
UPDATE OBJECTS
SET objects.Name = TRIGGER_POLICY.PolicyPath
FROM OBJECTS, TRIGGER_POLICY
WHERE objects.UniqueID = TRIGGER_POLICY.UniqueID
AND objects.name LIKE ‘INVOKE%’ AND Deleted = ‘0’
GO
You don’t need to checkout your runbook to  apply the modification, just refresh the console after the update.
Please note that is unsupported as we modify settings in the database direct. This is provided “AS-IS†with no warranties at all. This is not a solution for your production environment, just a idea and an example.
Recent Comments