Share via


Retrieving Users with the Active Directory Name Attribute

How come I can't use the Active Directory Name attribute as an Identity? Exchange lets you use the Name.

Why can't you use the Name attribute as an Identity? Well, we're not really sure; that decision was made before we joined the Lync Server PowerShell team. But while you can't use the Name attribute, you can use any of the following as a user Identity in Lync Server PowerShell:

· The user's SIP address.

· The user's user principal name (UPN)

· The user's domain name and logon name, in the form domain\logon (for example, litwareinc\kenmyer).

· The user's Active Directory display name (for example, Ken Myer).

· The user’s Active Directory distinguished name.

If we had to guess, we'd say that 5 different ways of referencing a user's Identity was considered good enough. After all, each additional way requires extra programming, extra testing, extra – well, extra whatever. You get the idea

That said, if you really want to use the Name any time you're working with a user account, well, there is a way to do that: just use the LdapFilter parameter instead of the Identity parameter. The LdapFilter parameter lets you filter user data by pretty much any Active Directory user account attribute. For example, this command returns the user who has the Name kenmyer:

Get-CsUser –LdapFilter "Name=kenmyer"

And what if you wanted to, say, assign this user a particular voice policy? Well, all you'd have to do is this:

Get-CsUser –LdapFilter "Name=kenmyer" | Grant-CsVoicePolicy –PolicyName "RedmondVoicePolicy"

We're not sure if that's any easier than using the user's display name or SIP address, but it'll work just fine.