Get Computer Custodian with Service Manager Integration Pack

Example System Center Orchestrator runbook for working with configuration item relationships to get the custodian/owner user details of a Windows Computer.

Solution Guide

What It Does

This example Orchestrator runbook shows how to get the “Custodian” user property of a Windows Computer configuration item in System Center Service Manager. Given the fully-qualified domain name of a computer in the Service Manager CMDB, the runbook returns the username, display name, and distinguished name of the user who is recorded as the Custodian of the matching computer.

The runbook also is a good example of a common pattern used when integrating System Center Orchestrator and Service Manager using the associated integration pack. The pattern involves getting information stored as relationships – in this case, the Custodian is related to the Windows Computer. With Orchestrator, one must follow the relationship to get to the related object. This is explained further below.

Usage Scenario

You can use this runbook for the specific example scenario (getting Custodian information about a given Computer) or as a template example for getting any relationship information from Service Manager’s configuration items using the Orchestrator integration pack.

How it Works

System Center Service Manager, as a configuration management database (CMDB), stores records like Computers and Users as configuration items. Each configuration item has various direct properties like Name, Description, etc, but often it will also have relationships to other configuration items. In this example, a Windows Computer is related to an Active Directory User through the “Owned By User” relationship. This relationship appears in the Service Manager console as the “Custodian” property.


Service Manager's Computer configuration item form
Service Manager's Computer configuration item form


To work with relationships through the Orchestrator integration pack, you need to do three things:

  1. Get the initial/source object. This is what you view in the console that has the property you want.

  2. Get the relationship to the target object (“related object”). This is not visible in the console, but can be ferreted out by knowing what the type, or class, of the target object is.

    1. There can be multiple relationships to the same type of object. For example, a Computer can have a Primary User and a Custodian, each a relationship to an Active Directory User. When you ask for relationships to Users, you’ll get both back, and therefore have to filter down to the one you want by knowing the name of the relationship.

  3. Get the related object. This is the target object on the other end of the relationship. Be careful not to confuse this with the relationship itself, or the relationship ID.

This diagram shows how the approach ties into each runbook activity:


Follow the yellow-brick relationship road with Orchestrator runbook
Follow the yellow-brick relationship road with Orchestrator runbook


In the example, we do the following:

  1. Get the source configuration item, which is an object of class “Windows Computer”. We use the “DNS Name” filter to match on the provided FQDN to return only the computer we’re interested in.

  2. Next, we get all relationships that involve the Windows Computer we got in step 1 and any object of class “Active Directory User”. We ask for any relationships between Object Class “Windows Computer” with the Object GUID of the returned object with a Related Class of “Active Directory User”. This may return one or more such relationships.

  3. Now we use the subsequent link criteria to only allow the Custodian relationship to be processed. This type of relationship happens to be named “Owned By User” internally, which can be discovered by running the runbook initially and seeing what the returned Relationship Class values are.

  4. Finally, we get the owner/custodian user object. To do so we get the object of class “Active Directory User” that has an SC Object Guid equal to the Related Object Guid from the relationship. Be careful not to use the Relationship Object Guid!

  5. Once you have the user object, you can get any values you like from it for return, such as the username.

You can explore each of the activities using the Runbook Viewer above.

Implementing In Your Environment

To give this a try in your environment, simply download using the button at the top of the page and import as described here. Make sure you have the latest SC 2012 Service Manager integration pack installed prior to import.

If you run into trouble or have further questions, feel free to let us know in the comments below or by getting in touch. Enjoy!