After stopping all running/pending runbooks to perform maintenance on the SCOrch environment, it becomes cumbersome to start all runbooks that begin with a monitor date/time activity (especially when the number of runbooks to start climbs above 100….).
You can create a SharePoint list (Figure A) of runbooks that need to be started after maintenance (good to document nonetheless) that Orchestrator can reference to start all of them automatically!
The main field that we need to use is the RunbookID in the SP list. I also use a field called "Active" in the list to exclude workflows that may not need started in case there is any reason that they shouldn't be started for the time being.
Figure A
The workflow is made up of three runbooks. A main which queries the SP list for the active runbook ids to start, the execute which starts the targeted runbook, and a seperate runbook to keep track of processed runbooks to later check for any errors.
Main (Figure B)
Figure B
The main starts by resetting a counter to cleanup from previous runs. Then it uses the Microsoft SharePoint IP by Jeff Fanjoy (more info here http://orchestrator.codeplex.com/releases/view/75877) to query the list identified in the SP IP configuration in options. Within the properties of the Get Active Runbooks activity, the filter is modified to choose the "Active" field set on the list object (Figure C).
Figure C
From the runbooks found in the list query, it will invoke the execute runbook with the runbook id and runbook name. It also invokes the counter modification runbook with a parameter – increment (note this invoke must set the property to wait for completion – See Figure E).
Exploring the execute runbook that's invoked in Figure D….it uses the Standard Logging IP (more info here http://orchestrator.codeplex.com/releases/view/76097). It starts the targeted runbook (you can reference this from my previous post – http://jmattivi.blogspot.com/2012/06/scorch-powershell-to-start-runbook-part.html). Upon success or failure to start the runbook, it invokes the counter modification runbook with a parameter – decrement (note this invoke must set the property to wait for completion – See Figure E).
Figure D
Figure E
Moving back to the Main runbook (Figure B), it waits for the counter value to be 0 – indicating processing has completed. If not it hits a timeout after 15 minutes and sends an error email for investigation. It then queries the Standard Logging table in the database for any failures to start runbooks from the execute runbook. If errors are found, it uses a Powershell script to parse the flattened data back into multi-valued data and send that information in an email. If no failures are found, it sends a success email that all targeted scheduled runbooks have been started successfully.
No comments:
Post a Comment