Our Story

Who we are and how we solve complex IT challenges.

Our Certifications

Microsoft certifications and partnerships validating our technical expertise.

Leadership

Meet the Experienced Leadership Team Driving WME’s Success

Advisory Updates

Expert guidance on Microsoft, security, and compliance developments.

Case Studies

Real-world outcomes from complex Microsoft-focused IT engagements.

Financial Industry

Secure technology solutions for regulated banks and financial institutions.

Healthcare

Secure Microsoft solutions for compliant, connected, and modern healthcare organizations.

Manufacturing

Cloud and security solutions supporting modern manufacturing operations.

Non-Profit

Cost-efficient Microsoft solutions for mission-driven organizations.

Public Sector

Microsoft-based IT services for secure public sector modernization.

High Tech

Scalable cloud, security, and staffing for fast-growing technology companies.

SMBs

Scalable cloud, security, and staffing for fast-growing technology companies.

Cloud Migration Services

Transition your workloads to the cloud securely for greater scalability and performance.

Data Migration Services

Securely transfer your business data with minimal downtime and maximum integrity.

Application Migration Services

Move your applications seamlessly to modern platforms with minimal business disruption.

Identity & Security Migration Services

Strengthen identity management and security while transitioning to modern Microsoft solutions.

IT Staffing

Connect with skilled IT professionals to strengthen your team and accelerate project delivery.

Accounting & Finance

Connect with experienced accounting and finance professionals to support your business goals.

Licensing Support

Discover the benefits of both CSP and On-premises licensing options and find the best fit for your unique business needs. From cost savings to flexibility, we’ve got you covered.

Power Platform

Unlock the full potential of the Microsoft Power Platform Suite to streamline operations, automate repetitive tasks, and gain real-time insights that drive business growth.

Sharepoint Solutions

Supercharge your business productivity and enhance visibility through our proven SharePoint expertise.

Security Solutions

Protect your business with proactive cybersecurity, compliance, and risk management solutions.

Endpoint Management

Secure, manage, and monitor every device with modern endpoint management solutions.

Required Deployment Failures using Orchestrator

July 17, 2013

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

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: https://www.microsoft.com/en-us/download/details.aspx?id=28725).

Background

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:

$a=@()

$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: https://technet.microsoft.com/en-us/library/b80344d7-3df6-48bc-a05f-f33257360b2a#BKMK_ProcGetCollMember. 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.

Share:

Facebook
Twitter
LinkedIn

Get Microsoft Updates Before They Cost You Downtime

Retirement dates, licensing changes, and security updates from a Microsoft-exclusive team, sent when they matter, not on a filler schedule.

More Posts

Copilot Cowork: Credit-Based Billing

Until now, Copilot Cowork has been included with M365 Copilot Premium licenses. Now that Cowork has moved out of public preview, Cowork is introducing a ...
Read Full Article
SharePoint OTP Retirement Is Coming in July 2026

SharePoint OTP Retirement Is Coming in July 2026 — What IT Admins Need to Do Before Access Breaks

Starting July 2026, external users who access OneDrive and SharePoint files through legacy SPO OTP links will start receiving access denied — silently, with no ...
Read Full Article
Power Virtual Agents Is Gone. Here's What Replaced It and Why It Matters.

Power Virtual Agents Is Gone. Here’s What Replaced It and Why It Matters.

If someone on your team still calls it “Power Virtual Agents,” they’re working from an outdated map. Microsoft retired the product on November 15, 2023 ...
Read Full Article

Get Microsoft Updates Before They Cost You Downtime

Retirement dates, licensing changes, and security updates from a Microsoft-exclusive team, sent when they matter, not on a filler schedule.
Subscription Form email