Today I am working on Runbooks for Configuration Manager 2012.

Part of this runbook has to find a user in the active directory, and afterwards find his manager’s email address, before sending an email to the manager.

image

So I start by search for the user in the “Get User ” Activity.

I get the result, and have the “manager” field as Distinguished Name format.

I setup the “Get manager” (Get user activity), and need to set the filters to search for this DN.

Problem is that it is not possible to select DistinguishedName as filter!!

image

What to do………….. First of I spend some time complaining, but when I was done crying I figured something out! 😉

by reading the manual at http://technet.microsoft.com/en-us/library/hh553476.aspx

you will see that it is possible to set different properties for the search.

These properties include

Element

Description

Valid Values

ReturnDNOnly

If true, only the Distinguished Name property will be returned instead of all properties

Boolean

Search Root

The distinguished name of the node in the Active Directory Domain Services hierarchy where the search starts

String

Search Scope

The scope of the search that is observed by the server. The options are Base, OneLevel or SubTree.

String

Oh! We can use the “Search root” to select where we want to start our search! This means I can map the manager DN to this property and define no filters, and our result will be the user!

image

I did also define the “Search scope” as base. This means I will not search in any sub objects of the root object. (since a user is not a container, it is not possible to have any subs, but I seemed to perform faster anyway.

So there you have it! How to search for DN by using “Get User”