Automating Multi-Tenancy in Exchange Server 2010 SP2 (Part 5)

If you would like to read the other parts in this article series please go to:


Welcome to System Center Orchestrator! If this is your first time then I hope you feel welcomed and excited as well!

The main screen of Orchestrator (Figure 01) is divided into 3 main areas: on your left side you have your Runbooks where we are going to create a new one (right click, click New and then Runbook), Computer Groups (a group of computers that can be referenced from our Runbooks), Runbook Servers (the actual Orchestrator Servers that run our automation runbooks) and Global Settings (where we can define variables and schedules to be referenced from Runbooks).

Our next step is to move activities to our Runbook and I would like to introduce you to the first activity which is the Initialize Data located under Runbook Control. That activity is responsible for requesting information from the end-user that is using our Runbook. Let’s drag and drop into our brand new Runbook. A new dialog box will appear with the information Are you sure you want to check out this runbook? Click Yes.

You can look around and you will see tons of interesting activities, and we can also add additional activities through IP (Integration Packs) that can be downloaded from Microsoft.

Figure 01

Let’s explore our first item which is Initialize Data by doing a right-click and then Properties. Each activity will have its own set of tabs located on the left side. On the Details tab we can click on the Add button to add parameters that will be requested from the end-user and based on our manual process we know that we need two pieces of information – Domain and the short-name for a future tenant. Based on that we are going to click on the Add button twice and for each new data dialog box we are going to add the name of our desired fields, as shown in figure 02. After adding our two required fields, click Finish.

Figure 02

That’s great! How can we test it? Hang in there and let’s add one more activity. Expand Email on the right side and drag and drop Send Email into our Runbook. We have two activities that are not connected. To connect them click the Initialize Data icon and then a white arrow will show up on the right side. Hover the mouse on it and then you can create a link with another object which in our case is the Send Email activity. The result will be similar to the one shown in Figure 03.

Figure 03

Awesome, in theory when we execute this Runbook we will have a dialog box requesting two pieces of information, and after that the Send Email activity will take over, however we need to configure the second activity to do something.

In order to do that, get the properties of the Send Email and you will realize that we have more tabs available. Click on Details first and then enter the information that we want to send in the Subject, Recipients and message. However Orchestrator allows us to be dynamic and we don’t need to create static content. We can use information that is on this Runbook to provide more details and be more dynamic. A good example is the Message field: right-click and click Subscribe, and then Published Data as shown in Figure 04.

Figure 04

In the new window (Figure 05) we can choose an activity. Choose Initialize Data and here we have the two fields that we created previously. Select Domain and in a different portion of the message let’s add the short-name field as well.

The domain <Domain field> was created and the short-name <Short-name field> was defined for the Address Lists.

The <Domain Field> is represented by {Domain: from “Initialize Data”} by Orchestrator where Domain: is the field name and Initialize Data is the activity.

Figure 05

One last detail before moving forward, we need to go to the Connect tab, and then type in the from: address and the Exchange Server that will be used. If the Receive Connector that you are going to use requires authentication then you need to check the Advanced tab and fill the information.

Okay, time for testing!! Let’s click Runbook Tester on the main screen of Orchestrator and a new window will be opened (Figure 06). On the new screen we have several sections, on the bottom left side we can select any Activity and the information will be displayed. On the bottom right side we have content (if applicable) for Computer Groups, Counters, Variables and Schedules. Click Run.

Figure 06

As expected the first page (Figure 07) will request some information from the end-user, so let’s provide information for a new tenant ( and WN as short-name).

Figure 07

In the Log section each task will be listed with its status (Figure 08) and we can troubleshoot what is going on.

Figure 08

Since the results were positive open our OWA and we should find a message waiting for us (Figure 09). Notice that the information provided was added to the message. Pretty cool, uh? Well, now that becomes interesting, we may have Orchestrator running reports for us and sending them by e-mail. That’s a piece of cake, as a matter of fact let’s do one of these before finishing up this article, shall we?

Figure 09

Creating a general report of all mailboxes

Okay, that is a little detour from our main goal but it is important to show you how to play around with Orchestrator before going to our multi-tenant automation Runbook.

Let’s see how easy it is to create a report of our existent mailboxes. Let’s create a new Runbook, move and link two activities: Run .Net Script and Send Email, as shown in Figure 10.

Figure 10

In the Run .Net Script activity configure the type to PowerShell and type in these 3 lines in the Script field. One last thing, please create a folder called Reports on the C: root drive.

$EXSession = New-PSSession –ConfigurationName Microsoft.Exchange –ConnectionURI http://poaex01.apatricio.local/PowerShell

Import-Session $EXSession

Get-Mailbox | Select Name,DisplayName,PrimarySMTPAddress,OrganizationalUnit | Export-CSV C:\Reports\Users.csv –NoTypeInformation

–          where the poaex01.apatricio.local is my Exchange Server.

The last step is to configure the Send Email activity to send an attachment, just type in the name of the file C:\Reports\Users.csv as you defined in the script that will run before the Send Email activity.

Now we are almost ready, we just need to execute the Runbook. The result will be a new message in the mailbox of the defined user of the activity with the CSV attached (Figure 11).

Figure 11

End-user experience using Orchestrator…

Well our main goal in this article series is to allow our secretary to create the new tenants by creating an automated task where she doesn’t have any special permissions in our environment. However with a few pieces of information she will be able to get a new customer up and running without asking for help.

So far, we have covered how to create a Runbook but the presentation for the end-user is different, basically our secretary can go to the website (default address is http://<Server-Name>:82>) and all Runbooks that she has the permissions on will be displayed (Figure 12). In order to start any given Run book the end-user just has to select it and then click Start Runbook from the Toolbox Actions area.

Figure 12

Since we created an Initialize data activity the end-user will be requested the same information that we created and tested during the Runbook Testing phase, as shown in Figure 13.

Figure 13


In this article we went over the basic concepts of Orchestrator. Based on these key concepts we are going to develop the automation process for a new tenant.

Bear in mind that Orchestrator has tons of resources on top of these few key points that we saw in this article. Your only limitation is either time or imagination to develop your own runbooks.

If you would like to read the other parts in this article series please go to:

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top