The last couple of weeks I’ve done some posts about using Orchestrator in combination with ConfigMgr 2012. This week I’ve got another one and it’s also another method to invoke a runbook. Until now I’ve used, either Runbook Commander to create right-click actions, or the Execute Runbook –step from MDT 2012 to start an action during a task sequence. This week I’m going to use SCOJobRunner – Command Line Utility, by Robert Hearn, to invoke a runbook as an action for a Status Filter Rule. SCOJobRunner can be used to, either invoke a runbook, or get the parameters of a runbook. For a good informational post about SCOJobRunner take a look at this post of Robert Hearn himself.
In this post I want to show how to invoke a runbook as an action for a Status Filter Rule by creating a basic runbook for deleting a direct collection membership rule. I know Jörgen Nilsson already did a similar runbook and executed it during a task sequence, but in this case it’s about showing possibilities and not about showing fancy runbooks. For the rest of this post the following points are prerequisites:
- SCOJobRunner needs to be present on an accessible location for the Site server.
- The Site server needs to be member of the OrchestratorUsers.
- Register, Deploy and Configure the System Center 2012 – Configuration Manager Integration Pack.
- Add an Initialize Data –activity and double-click it. In the Details Information click Add and a new parameter named Parameter 1 will be added. Now click Parameter 1 and change the name to ComputerName. Repeat that action and rename Parameter 2 to CollectionName, click Ok and click Finish.
- Add a Delete Collection Rule –activity, link it with the previous activity and double-click it. In the Details perform the following actions and click Finish.
- Right-click the field next to Collection and select Subscribe > Published Data. In the Published Data –popup, select with Activity Initialize Data, select CollectionName and click Ok.
- Click with the field next to Collection Value Type on … and then select in the Item Selection –popup Name and click Ok.
- Right-click the field next to Membership Rule and select Subscribe > Published Data. In the Published Data –popup, select with Activity Initialize Data, select ComputerName, and click Ok.
- Click with the field next to Membership Rule Type on … and then select in the Item Selection –popup Direct Rule and click Ok.
Status Filter Rule
Now let’s start with the, coolest part, configuring the Status Filter Rule. This rule has to perform the delete collection membership action after a successful deployment of a specific task sequence. To invoke the runbook as an action for a Status Filter Rule use the following configuration:
- In the Configuration Manager Console, navigate to Administration > Overview > Site Configuration > Sites.
- In the Home tab click Settings > Status Filter Rules, click Create and the Create Status Filter Rule Wizard will show.
- On the General page fill in as Name <aName> and select the following criteria and click Next.
- Select Source and then select Client.
- Select Message ID and fill in 11171.
- Select Property and then select Package ID.
- Select Property Value and then select <aTaskSequenceId>.
- On the Actions page select the following actions and click Next.
- Select Report to the event log.
- Select Run a program and fill in with Program <Dir>:\SCOJobRunner.exe -ID:”<aRunbookID>” -Webserver:”<aWebserver>” -Parameters:”ComputerName=%msgsys;CollectionName=<aCollectionName>”.
- Note: The idea here is to match aTaskSequenceId with aCollectionName.
- On the Summary page, click Next.
- On the Completion page, click Close.
As always, now it’s time to look at the results and like all other times there are lot’s of places to look at. This time I won’t show any log files, but “just” the successful results from the actions of the Status Filter Rule. I configured the rule to perform two actions. The first action is to report to the event log (see first picture) and the second action is to invoke a runbook (see second picture).