Required Deployment Failures using Orchestrator

This article is part of an ongoing series on how to use Orchestrator and CM 2012 together. For more articles, please go to

I have been trying to come up with a way to receive an automated email detailing devices with failed required deployments. This runbook accomplishes this goal. In order to complete it, you will need the CM 2012 Orchestrator integration pack (available here: and Data Manipulation integration pack (available here:


This runbook uses a WMI query to pick up all required deployments in your environment. It then uses the “Get Deployment Status” activity from the CM 2012 integration pack to look at the deployments and determine what computers failed to install the application. Finally, it sends an email with a list of those computers.

This is a fairly simple runbook, and should not take very long to create. This runbook only works for Applications and does not work for Packages.

Find Required Deployments

This step runs a WMI query against the SMS_ApplicationAssignment class. There is a property called OfferTypeID within this class that is set to “0” if the deployment is required and “2” if the deployment is available.

To create this activity, drag a “Run .NET Script” activity into your runbook (located under the “System” node). Double-click it to open it and click on the “General” tab to name the activity. Next, select the “Details” node and change the language type to PowerShell. Paste this code into the “Script” box:


$assignments = Get-WmiObject -ComputerName <CM
2012 primary site server> -Namespace root/SMS/site_ <CM
2012 site code> SMS_ApplicationAssignment | Where-Object -FilterScript {$_.OfferTypeID -eq “0”}

ForEach ($assignment in $assignments) {
$idint = $assignment.AssignmentID
$id = “$idint”
$name = $assignment.ApplicationName

$a += $id + “%” + $name

Be sure to replace the text in blue with the actual FQDN of your primary site server and your site code. The first thing this code is doing is establishing an array. We need an array so that Orchestrator executes the rest of the runbook for each required deployment. Next, we are running the WMI query that pulls all deployments that are required. Finally, the ForEach statement processes each required deployment and pulls out the ApplicationName (to be used in the email) and the AssignmentID. The AssignmentID in this case cannot be the same across multiple deployments. It serves as sort-of a primary key for assignments. The ID is being set in two variables here because its data type is Integer, and to combine it with the name in array it must be a String value.

I am combining the name and ID so that I only have one array running and the name moves with the ID. I will split the two back out in the next activity. I am using a percent sign to separate them because I do not have that symbol in any application name, and I can use whatever character I want in the next step to split the field. You can use whatever character you want here to separate your fields.

Finally, we must publish the array. To do this, select the “Published Data” node, and click the “Add” button. Complete the box like this:

Split Fields

Next, we need to split the ID and the name apart. To do this, add a “Split Fields” activity (located under the “Data Manipulation” node). When you open the activity, insert the Published Data from the previous activity into the “Input String” field and change the “Split Delimiter” field to whatever you chose for your split character.

To insert the Published Data in the input string field, right-click in the box, select “Subscribe”, and then “Published Data”.

Get Deployment Status

Next, add the “Get Deployment Status” activity (located under the “SC 2012 Configuration Manager” node). If you have not set up the connection to your CM 2012 environment, follow these instructions: Select the connection in the top box, then select “Application” in the second box.

Now we need to set up the filters so that we only look at required applications and only pull data on those devices that failed. To do this, click the “Add” button. In the “Name” box, select “AssignmentID” and keep “Relation” set to equals. In the value box, add the published data from the “Spilt Fields” activity. If you kept everything the way I have it, the AssignmentID should be Field01. Your box should look like this:

Next, we need to add the filter for ComplianceState. When this field equals “1”, the deployment was successful. When it equals “2”, it failed. We are only interested in devices that failed, so we can filter for that. Add another filter, and set the settings like this:

When you click OK on the “Filter Settings” box, your “Get Deployment Status Properties” window should look like this:

When the activity outputs its data, it does it as an array. If we kept the output as array, we would get a separate email for every computer that failed. To fix this so that we get an email per deployment and not per computer, select the “Run Behavior” node and check the “Flatten” check box. Next, select the button on how you want the output to be configured. I prefer to separate the device names using line breaks, but you can format it however you want.

Send Email

Finally, add the “Send Email” activity to your runbook (located under the “Email” node). In the subject box, add what you want the subject to say. Mine is called “Failed Deployment List – {Field02 from “Split Fields”}. The Published Data that I added is the application name from the “Split Fields” activity. This allows me to differentiate the deployments if I multiple going out at the same time. Again, if you set everything up the same way I have, the application name should be in Field02.

Next, add the Published Data for MachineName in the message box. It should look like this: {MachineName from “Get Deployment Status”}. This is part of the published data in the “Get Deployment Status” step. It will only add the device names that meet our two filter criteria. After these fields are filled out, the windows should look like this:

The only thing missing are recipients. Click the “Add” button to add them.

Next, configure the outgoing server settings in the “Connect” node. Fill them out according to your organization’s settings.

I hope this helps you evaluate your deployments a little easier. Please continue to check back for more Orchestrator runbooks to simplify your CM 2012 environment.


Picture of Matt Tinney

Matt Tinney

Professional IT executive & business leader having decades of experience with Microsoft technologies delivering modern-day cloud & security solutions.

Contact Us

On Key

More Posts

E-Commerce Security - Solutions for Online Retailers

E-commerce Security – Solutions for Online Retailers

Today’s hyper-charged e-commerce landscape demands top-notch cybersecurity measures. Cybersecurity for this bustling sector isn’t just about ticking a technical box; it’s the cornerstone of building trust. As businesses and consumers flock to the online space, the

Read More »
WME Cybersecurity Briefings No. 017
Cyber Security

WME Security Briefing 08 July 2024

SnailLoad: A New Stealthy Threat to Web Privacy Overview: Researchers discover a concerning new side-channel attack technique: SnailLoad. It exploits inherent weaknesses in the internet to potentially monitor a user’s web activity without requiring any direct access to

Read More »
WME Cybersecurity Briefings No. 016
Cyber Security

WME Security Briefing 27 June 2024

ExCobalt Cyber Gang Targets Russian Sectors with New GoRed Backdoor Overview An unknown Golang-based backdoor GoRed is being employed by the cybercrime gang ExCobalt. This group has roots dating back to at least 2016 and possibly originates

Read More »
Top 7 Office 365 Backup Solutions
Cloud Computing

Top 7 Office 365 Backup Solutions

Let’s explore the top 7 Microsoft 365 (Office 365) backup and recovery solutions. These solutions feature, among others, automated backups, detailed reporting, and efficient deduplication. We will guide you through their pros and cons and what

Read More »
WME Cybersecurity Briefings No. 015
Cyber Security

WME Security Briefing 24 June 2024

Google’s Privacy Sandbox Faces Scrutiny Over User Tracking Allegations Overview Google’s Privacy Sandbox was initially designed to replace third-party cookies in Chrome. It was a more privacy-conscious solution, but the Austrian privacy group Noyb is now

Read More »
Be assured of everything

Get WME Services

Stay ahead of the competition with our Professional IT offerings.