Looking for my soul

Mate. Must be Lync-enabled.

Non-smoker preferred.

 

If you believe what they say on TV (and, really, why wouldn't you believe what they say on TV?) then one of out every five new relationships starts through an online dating service. We like to think that Microsoft Lync Server 2010 is Microsoft's answer to online dating services such as Match.com and eHarmony.com.

 

Disclaimer. Everyone from the Lync Server product team to Microsoft's legal department to some guy walking down the street has just reminded us that we do not think that Microsoft Lync Server 2010 is Microsoft's answer to online dating services such as Match.com and eHarmony.com. We apologize for the misunderstanding.

 

Of course, it's definitely true that Lync Server is a little bit different than your usual online dating service. If you go to any of the other online dating services, you are able to search for that certain special someone who is intelligent, caring, responsible, romantic, flexible, understanding, faithful, compassionate, and communicative. That's nice, but, hey, who cares if someone is intelligent, caring, responsible, romantic, flexible, understanding, faithful, compassionate, and communicative? What you really want to know are things like their SamAccountName, the department they work for, their user principal name, and the date and time they last changed their Active Directory password. Those are the things that really matter in a relationship, and yet most online dating services ignore those qualities altogether. But not Lync Server. Want to find all the people who work in the Finance department, or all the people who have not been assigned a SIP address? Then you need Lync Server and the Get-CsAdUser cmdlet.

 

Note. You're right: typically this is the spot where we list all the other cmdlets that use, in this case, the noun CsAdUser. Why aren't we doing that today? Well, there are a lot of reasons, but here's the main one: there aren't any other Lync Server PowerShell cmdlets that use the noun CsAdUser; CsAduser is somewhat unusual in that it only has the single verb Get. That means you can get information about Active Directory (AD) users, but you can't create new user accounts, delete existing user accounts, or otherwise change the basic (that is, non-Lync Server) Active Directory attributes for your users.

 

And you're right: that would have made a good Challenge question, wouldn't it? Now you tell us!

 

Admittedly, Get-CsAdUser has created a certain amount of confusion among Lync Server administrators; that's because Get-CsAdUser is designed to return information about Active Directory user accounts, which is fine except for the fact that there's another cmdlet (Get-CsUser) that's also designed to return information about Active Directory user accounts. As a result, it's not always clear to people which cmdlet to use, and when.

 

So when should you use Get-CsAdUser and when should you use Get-CsUser? Well, that depends on a couple of things. For one, there's the set of users you need information for. Get-CsAdUser is intended to return information about all your Active Directory user accounts, regardless of whether or not those accounts have been enabled for Lync Server. By contrast, Get-CsUser is intended to return information about only those user accounts that have been enabled for Lync Server. As a general rule, use Get-CsAdUser to look at all your accounts, and use Get-CsUser to look at just the accounts that have been enabled for Lync Server.

 

In addition to that, however, it also depends on what type of information you want returned. For the most part, Get-CsAdUser returns generic Active Directory information: office address, zip code, job title, department, etc., etc. What it doesn't return is Lync Server attributes such as the policies that have been assigned to a user. For that kind of data, you need to use Get-CsUser.

 

Note. Yes, it would be useful to see a table that compared the attributes returned by each cmdlet, wouldn't it? As it turns out, such a table exists, but we published it several months ago, before Lync Server was released, and a few of the items changed between the date the table was published and the time when Lync Server hit the shelves. Will we ever get in there and update the table? Looks like we'll have to now, won't we?

 

If you can't wait for us to get around and do our work, you can get a quick look at the attributes returned by each cmdlet simply by running these two commands:

 

Get-CsUser | Get-Member

Get-CsAdUser | Get-Member

 

For the most part, Get-CsAdUser is pretty easy to use. Would you like to get back information for all your Active Directory user accounts? Great; that's really easy:

 

Get-CsAdUser

 

How about information for just one user, Ken Myer? Okey-doke:

 

Get-CsAdUser –Identity "Ken Myer"

 

Or let's try getting a little fancy. What about all the users who work in the Finance department? OK, try this:

 

Get-CsAdUser –LdapFilter "Department=Finance"

 

Now let's get really fancy: the display name, department, and job title of all the users who have not been enabled for Lync Server. You know, a command like this one:

 

Get-CsAdUser –Filter {Enabled –eq $Null} | Select-Object DisplayName, Department, Title

 

Note. LdapFilter? Filter? –eq $Null? What is all that supposed to mean?

 

Relax; those are just filters you can use with Get-CsAdUser (and Get-CsUser) to help return a much more finely-targeted set of results. For more information, see the article Retrieving Active Directory and Microsoft Lync Server 2010 User Accounts.

 

And remember: beauty is only skin deep. What really matters is what a person is like on the inside.

 

And, of course, the values assigned to his or her user account control, their primary group ID, their proxy addresses, pager number, and country or region display name. All information, coincidentally enough, that can be retrieved by Get-CsAdUser.

 

Note. Do we feel bad that Lync Server will probably soon put all the online dating services out of business? Well, yes, a little. But you know what they say: all's fair in love and war.