Sync Configuration Manager Collections in Service Manager

This post is the 3rd in a series of posts focused on making common administrative tasks in System Center and Azure available via the Service Manager Self-Service Portal. The Configuration Manager Connector pulls a lot of information into Service Manager but not everything necessary to manage collections and collection membership. This solution allows for the synchronizing of Configuration Manager Collections and Collection Members into Service Manager on a schedule and on-demand.

Configuration Manager Console installed on runbook servers (open the console, make sure you can connect to your site server)

Operations Manager Console installed on runbook servers

Service Manager Console installed on runbook servers

Runbook servers configured to allow PowerShell scripts to run

Create a service account

Give the account admin rights to Service Manager

Give the account admin rights to Configuration Manager

Give the account admin rights to Operations Manager

Create a share to store scripts and logs

Create a share that the service account you created and authenticated users will have access to on the Runbook Servers that will be used for this scenario.

In the share, create a folder called "Automation" and give the service account access to it.

Copy SyncCollections.ps1 into the Automation Folder

In the share, create a sub-folder called "Logs" in the Automation Folder and give the applicable administrators access to it. Orchestrator will write logs to this folder and admins can use these logs for troubleshooting.

In the Logs folder, create a sub-folder called "SRLogs" and give authenticated users access to it. Users of the Service Manager Portal will use these to see the status of the Collection Sync task so they will need rights to this folder.

Note, the data between the curly braces are Published Data from the Data Bus. This is obtained by right-clicking on the white space and selecting the appropriate variable. You can also use Orchestrator variables configured under Global Settings for items such as CMSiteCode, CMSiteServer, and SMManagementServer.

Check In the Runbook

The Runbook should look like this:

Create the Sync Collections (Full – Scheduled) Runbook

This Runbook will launch a PowerShell script when it is triggered via a schedule. This will catch Collections and Collection modifications that have occurred outside of the Service Manager Self-Service Portal.

Open the Orchestrator Runbook Designer

Create a new runbook

Drag the "Scheduling\Monitor Date/Time" activity into the new runbook

Configure one setting under Details of the Monitor Date/Time activity and click Finish

Every: 1 hour

Drag the "System\Run Program" activity into the new runbook

Link the two activities

Configure the Security of "System\Run Program" to use the service account

Configure three settings under the "Details" section of the "Run Program" activity and click finish

Program path: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

You can also use Orchestrator variables configured under Global Settings for items such as CMSiteCode, CMSiteServer, and SMManagementServer.

Check in and Start this runbook.

The Runbook should look like this:

Summary

The on-demand runbook will be used in a future post for synchronizing Configuration Manager collections with Service Manager, including collection members and member count. The scheduled runbook will start working on the schedule to synchronize collections, collection members, and member counts every hour thereby picking up changes made outside of the Service Manager Portal.