Deploying an Application Using Orchestrator

Orchestrator can automate many tasks for you. One of its major features it its ability to integrate with other System Center products. In this article, I will show how you can deploy an application to a group of computers using a runbook. I will demonstrate how to do this with only a text file with a list of computers. This is meant to be a starting point, and can be adapted to meet your organization’s needs.

In order to complete this article, you will need the CM 2012 integration pack for Orchestrator. It can be downloaded here: https://www.microsoft.com/en-us/download/details.aspx?id=28725. This download includes all of the integration packs for System Center 2012.

Runbook Overview

This is generally what your runbook will look like. I will go over each step in detail later. To begin, we will tell the runbook what application we want to deploy. This can either be set to the application name or it’s ID. Next, we will create the collection based off the application name given. Next, we will find the current date and time and add two hours to it. Next, we will deploy the application as required. Then, we will import a list of the computers that we want the application deployed too. Finally, we will add the computers to the collection.

Now, why are we deploying the application before we add the computers to the collection? The “Import Computers” activity imports a list of machines as an array. Orchestrator handles arrays by splitting the runbook into individual processes for each item in the array. We only want to create the collection and deploy the application once, instead of many times. Given the speed at which runbooks execute, there should not be problem with a client missing a deployment.

Initialize Data

To begin, we need to tell the runbook what application we want to deploy. We can do that using the “Initialize Data” activity.

Simply drag the activity into your runbook (it is located under the “Runbook Control” section) and double click on it. Click the add button, and give your field a name.

Create Collection

Next, drag the “Create Collection” activity into your runbook (located under the “SC 2012 Configuration Manager” section). Double-click on it, and fill it out like mine:

The “Connection” box is configured by clicking on “Options” in the toolbar, then “SC 2012 Configuration Manager”. This is where you tell Orchestrator your server for your CM 2012 environment.

In the “Collection Name” field, I have inserted the published data provided by the “Initialize Data” activity. I also added “-deployment” to the end, just in case I already have a collection named like my application. You can do this if needed, or change it as needed.

I limited my collection to “All Systems”. This, of course, is another option you can change as needed.

Find Date

The scheduled-start date and installation deadline dates are both required in the “Deploy Application” step. I used PowerShell to get these values. To do this, drag a “Run .NET Script” activity into your runbook (located under the “System” node). Change the “Language” box to Powershell, and paste this code into the “Script” box:

$date = get-date
$startdate = $date.tostring(“yyyy-MM-ddThh:mm:ss”)

$date2 = $date.AddHours(2)
$enddate = $date2.tostring(“yyyy-MM-ddThh:mm:ss”)

This code is grabbing the current date and time and converting it into the correct format. Next, it is adding two hours to the current date and time. It stores both of these as variables that we will need in the next step. I added two hours to mine because I do not have any applications that take over two hours to install. This can be adjusted as needed in your environment.

Because this is a script, we must publish the data. To do this, click on the “Published Data” node add two values like this:

Deploy Application

Next, drag the “Deploy Application” activity into your runbook (located under “SC 2012 Configuration Manager”). Assign the correct configuration item just as we did in the “Create Collection” activity. Next, fill in the fields as shown:

The values in “Deployment name”, “Application”, “Collection”, “Schedule Availability”, and “Installation Deadline” are all published data from previous steps. The value in “Application” is particularly important. It is vital that you enter a valid application name in this field, if you do not, the runbook will fail at this step. The application name is the “Name” field when you create your application.

I left the distribution point options blank in my example because all of my applications are pre-deployed to my DP’s. You can set these options as needed.

I would also encourage you to look at the additional fields by clicking on the “Optional Fields” button. There may be more in there to assist your deployments.

Import Computers

This activity imports a text file of computer names to add to the collection. This text file is simply list of computer names on different lines. This file must be stored on a file share that the Orchestrator service account as access too (or on your Orchestrator server).

This activity, like the “Find Date” activity, is a PowerShell script. Add a “Run .NET Script” activity to your runbook and change the language to PowerShell. Paste this code into the script box:

$a = @()

$comps = get-content \deployment.txt

ForEach ($comp in $comps) {
$a += $comp
}

As mentioned before, this script reads the file and puts the computer names into an array. We need to publish the array to the next step by adding this published data:

Add Collection Rule

Finally, drag the “Add Collection Rule” activity into your runbook. Set the connection as we did in the “Create Collection” and “Deploy Application” step. Next, set the fields like this:

Again, the “Collection”, “Rule Name”, and “Rule Definition” fields are all published data from previous activities. I used a direct rule because I knew the computers I wanted to deploy too. You can also do a query rule if you want to base collection membership (and software deployment) on any sort of CM 2012 collection query.

Summary

This is quick way to manage your software deployments using Orchestrator. The best part about this is that now I can use the Orchestration Web Console to push software without the CM 2012 console. The “Deploy Application” step can also be easily switched out for “Deploy Program” or “Deploy Task Sequence”, making your deployments available from anywhere you have a Silverlight-enabled web browser.

Come back in the next few weeks for more CM 2012 and Orchestrator runbooks.

Share:

Facebook
Twitter
LinkedIn
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

WME Cybersecurity Briefings No. 020
Cyber Security

WME Security Briefing 26 July 2024

Pro-Houthi Group Targets Yemen Aid Organizations with Android Spyware Overview A suspected pro-Houthi group, OilAlpha, is targeting humanitarian organizations in Yemen with advanced Android spyware. The operation is associated with the activity cluster codenamed OilAlpha. It

Read More »
WME Cybersecurity Briefings No. 019
Cyber Security

WME Security Briefing 23 July 2024

Samba File Shares Targeted by DarkGate Malware in Recent Cyber Offensive Overview Recent investigations by Palo Alto Networks uncover a brief but significant cyberattack campaign utilizing DarkGate malware. This malicious software exploited Samba file shares to

Read More »
WME Cybersecurity Briefings No. 018
Cyber Security

WME Security Briefing 15 July 2024

OVHcloud Mitigates Record-Breaking 840 Million PPS DDoS Attack Overview In April 2024, OVHcloud, a top French cloud computing firm, successfully stopped a massive DDoS attack. The attack hit a record-breaking rate of 840 million packets per second

Read More »
E-Commerce Security - Solutions for Online Retailers
Azure

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 »
Be assured of everything

Get WME Services

Stay ahead of the competition with our Professional IT offerings.

=