Tweeting the deployment status of a system via Orchestrator and ConfigMgr 2012

Only a few days before Christmas I thought it would be fun to just create something extra cool for this weeks blog post. I thought about something that would be different, but also useful in some way. So I started thinking about how I would like to get my deployment status messages, as I like to start my deployments without checking them al the time, and I came to Twitter. I’ve got my tweets everywhere, on my phone, my tablet, my laptop, etc. So wouldn’t it be cool to get the deployment status messages on twitter?

Prerequisites

Now I decided that I want to show how to tweet the deployment status of a task sequence, there are two methods to do that and I will show them both. The first method is to use a Status Filter Rule and the second method is to use use the Task Sequence. For these methods, the following points are prerequisites:

  • The Microsoft Deployment Toolkit 2012 Update 1 –package is created.
  • The program SCOJobRunner is present on an accessible location for the Site server.
  • The Site server is member of the OrchestratorUser –group.
  • The Network Access Account is member of OrchestratorUser –group.
  • The Social Media Integration Pack, of VIAcode, is registered, deployed and configured.

Runbook

OrcRunBooTweLet’s start with configuring the runbook for tweeting the deployment status. To keep this runbook as general as possible, it will need two input parameters. In total this runbook contains two steps with the following configuration:

  • OrcRunBooIniDatDetAdd 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 Status, click Ok and click Finish.
  • Add a Tweet –activity, link it with the previous activity and double-click it. In the Details fill in the field, next to Text, the text to tweet and click Finish. OrcRunBooTweProIn this example I choose the line @pvanderwoude The deployment of ComputerName is Status!. To get this line in that field, follow the next steps:
    • Fill in the text “@pvanderwoude The deployment of “.
    • Right-click and select Subscribe > Published Data. In the Published Data –popup, select with Activity Initialize Data, select ComputerName and click Ok.
    • Fill in the text “ is “.
    • Right-click and select Subscribe > Published Data. In the Published Data –popup, select with Activity Initialize Data, select Status, and click Ok.
    • Fill in the text “!“. 

Method 1: Status Filter Rules

Now let’s start with the first method, which I also prefer, and that’s configuring the Status Filter Rules. These rules have to perform the tweet action after, either a successful, or a failed deployment of a task sequence. StaFilRulTweGenTo invoke the runbook as an action for the Status Filter Rules 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.
  • StaFilRulTweActOn the Actions page, select Run a program, fill in with Program <Dir>:\SCOJobRunner.exe -ID:”<aRunbookID>” -Webserver:”<aWebserver>” -Parameters:”ComputerName=%msgsys;Status=succeeded” and click Next.
  • On the Summary page, click Next.
  • On the Completion page, click Close.

This was the configuration for a Status Filter Rule with a successful deployment. To create a Status Filter Rule for a failed deployment repeat the steps from above and replace 11171 with 11170 and replace succeeded with failed.

Method 2: Task Sequence

Now let’s go to the second method and that’s configuring the Task Sequence. The task sequence will need some extra logics to see whether it failed or not. This means it needs the following three adjustments

  1. One to set a new variable, OSDDeploymentStatus with a default value of succeeded.
  2. One to change the value of the new variable, OSDDeploymentStatus, to a failed, but only if something in the previous part of the task sequence failed if needed
  3. One to invoke the just created runbook with as input the name of the system and the status of the deployment.

TSEdiTweSta01So to put these adjustments together to real configuration changes follow the next six steps:

  • Add a New Group, fill in <aGroupName> and select in the Options –tab Continue on error.
  • Add a Set Task Sequence Variable –step, set Task Sequence Variable to OSDDeploymentStatus and set Value to succeeded.
  • Add a New Group and fill in <aGroupName>.
  • TSEdiTweSta02Add a Set Task Sequence Variable –step, set Task Sequence Variable to OSDDeploymentStatus and set Value to failed. Then go to the Options –tab and click Add Condition > Task Sequence Variable. In the Task Sequence Variable –popup, fill in as Variable _SMSTSLastActionSucceeded, set as Condition equals, fill in as Value False and click Ok.
  • Add an Use Microsoft Deployment Toolkit Package –step and Browse to the Microsoft Deployment Toolkit 2012 Update 1 –package.
  • TSEdiTweSta03Add and Execute Runbook –step, fill in with Orchestrator Server <anOrchestratorServer> and Browse with Runbook to the just created runbook. Then select Specify explicit runbook parameters, fill in with ComputerName %_SMSTSMachineName%, fill in with Status %OSDDeploymentStatus% and select Wait for the runbook to finish before continuing.

Result

As always, after all the configuring, it’s time to look at the results. Normally I like to show log files, or screenshots from console, or screenshots from the event viewer, but this time it’s time for something different. Specially for this post I created a new twitter account that, from now on, will show the deployment status of my lab systems. Those tweets are done by @MyTaskSequenceS and look like this:

TasSeqStaTwe

3 thoughts on “Tweeting the deployment status of a system via Orchestrator and ConfigMgr 2012

Leave a Comment