Limiting the Number of Contacts a User Can Have


Having friends – lots of friends – is great. For example, on Facebook actor Ashton Kutcher has 3,367,035 friends; his wife, actress Demi Moore, has 1,292,835 friends of her own. (Sending out Christmas cards must be a full-time job at their house.) By comparison, PowerShell writer Jean Ross has 21 friends. As for PowerShell writer Greg Stemp, well, here’s the message that the good folks at Facebook left for him:

 
“We'd like to help you find your friends. Your friends on Facebook are the same friends, acquaintances and family members that you communicate with in the real world. You can use any of the tools on this page to find more friends.”

 
That should give you an idea how many friends he has.

 
Note. Sadly, our new Microsoft Lync Server 2010 PowerShell group doesn’t have very many friends, either. To join our new group, log onto your Facebook account and search for Communications Server PowerShell. We can’t promise to be as entertaining as Ashton Kutcher (sample post on Ashton’s wall: “dont forget to dance today!”) but we can promise to provide more information on the Microsoft Communications Lync 2010 implementation of Windows PowerShell than Ashton will.

 
Well, OK, maybe not more PowerShell information than Ashton Kutcher. But definitely more than Demi Moore.

 
The point of all this (and trust us, there is a point hidden in here – somewhere) is that you can never have too many friends. However, it is possible to have too many Microsoft Lync contacts. After all, Microsoft Lync has to continually retrieve and update presence and status information for each of your contacts (and each of your colleagues’ contacts). If you have a couple hundred contacts, that’s probably no big deal. But if you have 3,367,035 contacts, well ….

 
In other words, in order to save on network bandwidth, and to reduce wear-and-tear on your servers, you might want to limit the number of contacts your users can have. And in this article, we’ll tell you exactly how to do that.

 
Before we begin, however, we should note that there already is a limit on the number of contacts your users can have: it’s 250. How do we know that? Well, we know that because we closely follow the postings of people like Ashton Kutcher and Demi Moore (who no doubt just as closely follow our postings). In turn, we’re pretty sure one of them told us that we can determine the maximum number of contacts a user can have by running this command:

 
Get-CsUserServicesConfiguration

 
If we look at the value of the MaxContacts property we should see something like this:

 
MaxContacts:         250

 
There you go: by default users can have, at most, 250 contacts. If you’re fine with limiting all your users to a maximum of 250 contacts then your work is done. Take the rest of the day off, with our compliments.

 
But what if you’re not fine with limiting all your users to a maximum of 250 contacts? What if that number is too high, or too low? Or what if certain users (e.g., sales people or human resource counselors) need more contacts than other users? If that’s the case, then you’ll have to keep reading.

 
Yes, there always is a catch, isn’t there?

 
To begin with, you might have noticed that we used the cmdlet Get-CsUserServicesConfiguration to retrieve the maximum number of contacts a user can have. When you install Microsoft Lync Server 2010 you get a single collection of user services configuration settings, a collection configured at the global scope. However, you can also create custom user services configuration settings at either the site scope or the service scope. (For more information, see the article Scopes and Filters.) For example, suppose you have additional bandwidth in the Redmond site, and would like to allow those users to have as many as 400 contacts. In that case, you can create a custom set of user services configuration settings for the Redmond site:

 
New-CsUserServicesConfiguration –Identity site:Redmond –MaxContacts 400

 
See how easy that is? You can also separately configure each User Server. For example, suppose the users who log on to the pool paris-cs-001.litwareinc.com don’t need very many contacts. In that case, you can create a new user services configuration collection and assign it just to the User Server on that pool:

 
New-CsUserServicesConfiguration –Identity service:UserServer:paris-cs-001.litwareinc.com –MaxContacts 100

 
See how that works? In that case, only users who log on to the pool paris-cs-001.litwareinc.com will be limited to 100 contacts. Users who log on to other pools in that same site will have as many contacts as the site or global settings allow them to have.

 
Of course, you can also use the Set-CsUserServicesConfiguration cmdlet to modify an existing collection of user service settings. For example, suppose bandwidth isn’t a major concern, and you figure that you can allow all your contacts to have at least 750 contacts (the absolute maximum number allowed by Lync Server is 1000 contacts). In that case, a command like this will change the maximum number of contacts allowed by the global user services configuration settings:

 
Set-CsUserServicesConfiguration –Identity global –MaxContacts 750

 
Now, that’s pretty good – up to a point. If it’s OK that all the users in a given site have the same limitation in regards to the number of contacts they have, well, then by all means create a custom set of user configuration settings for that site and call it good. But what happens if you want different strokes for different folks: in other words, what if some people in the site should be able to have more contacts than others?

 

Note. Yes, it does kind of sound like the book Animal Farm, doesn’t it: “All animals are created equal. But some animals are more equal than others.” But, trust us: in reality it’s nothing at all like Animal Farm.

 
Here’s where it gets a little complicated. (Not hard, mind you, just a little complicated.) The user services configuration settings determine the maximum number of contacts you can have per User Server, per site, or per installation of Microsoft Lync Server. (The per-installation setting, typically referred to as the global setting, is used if you haven’t configured any per-service or per-site settings.) Let’s say you use only the global settings, and you configure MaxContacts to 500. That means that no one in the organization – no one – can have more than 500 contacts.

 
However, thanks to client policies, it’s possible for someone to have a maximum number of contacts less than 500. (Remember? Some users are more equal than others.) For example, let’s say you want to limit Ken Myer – and just Ken Myer – to 100 contacts. (OK, not a very likely scenario, but we want to keep things simple for now.) In order to do that, the first thing we need to do is create a new per-user policy that sets the maximum number of contacts a user can have to 100. Here’s a command that creates a new per-user policy named MinimalContacts and sets the maximum number of contacts to 100:

 
New-CsClientPolicy –Identity "MinimalContacts" –MaximumNumberOfContacts 100

 
And here’s how you assign that policy to Ken Myer:

 
Grant-CsClientPolicy –Identity "Ken Myer" –PolicyName "MinimalContacts"

 
And what’s the net effect of all this? The net effect is that Ken Myer will be allowed a maximum of 100 contacts; that’s the value set in the per-user client policy Ken’s been assigned, and the per-user policy will take precedence over the user services configuration settings.

 

Note. The per-user client policy takes precedence as long as the maximum number of contacts configured in the policy is less than the maximum number configured in the user services settings. You can never exceed the value set in the user services settings.

 
As for everyone else in the organization, well, they’ll be allowed to have up to 500 contacts. That’s because, with no per-user policy dictating otherwise, they can have as many contacts as the user services settings allow them to have.

 
See how that works? You can never have more contacts than the user services settings allow you to have. But you can be restricted to fewer contacts than that, provided that you’ve been assigned a client policy that limits the maximum number of contacts you can have.

 
In other words, if you want to know the number of contacts any user can have you need to check in two places. First, you need to check the user services configuration settings to determine the absolute maximum number of contacts that user can have. For illustration purposes, let’s assume that’s 350 contacts. Second, you need to check to see if the user has been assigned a client policy (client policies can be assigned at the global, site, or per-user scope) that further limits the number of contacts. If a user’s client policy limits him or her to 200 contacts then he or she can have, at most, 200 contacts. And what if the client policy allows the user 900 contacts? In that case, the user can have, at most, 350 contacts. That’s because the user service configuration settings have imposed an absolute maximum, of 350.

 
Or to put it a little more graphically:

 

User service settings

Client policy settings

Actual number of contacts allowed

350

200

200

350

900

350

350

No policy configured

350

 
Like we said, it’s a little complicated. But definitely not hard.

 
By the way, here’s a bonus command that might be of interest to you. Suppose you wanted to limit all your users to 250 contacts, with one exception: people in the Sales department (who should be allowed up to 500 contacts). How would you do that? Well, here’s one suggestion. First, use this command to set the global user services configurations settings to allow users 500 contacts:

 
Set-CsUserServicesConfiguration –Identity global –MaxContacts 500

 
Next, create a new per-user client policy that limits users to 250 contacts:

 
New-CsClientPolicy –Identity "BasicClientPolicy" –MaximumNumberOfContacts 250

 
Finally, assign that new policy to everyone except people who work in the Sales department:

 
Get-CsUser –LDAPFilter "!(Department=Sales)" | Grant-CsClientPolicy "BasicClientPolicy"

 
We won’t explain how this particular command works; for more information, see the articles on creating filters and assigning policies. But trust us: it works.

 

Note. Don’t forget to check out our new Facebook group devoted to Lync Server PowerShell. Needless to say, some of us need all the friends we can get. At the rate we’re going right now, just 3,367,034 more friends and we’ll pass Ashton Kutcher. Be afraid, Ashton; be very afraid.

 

Comments (4)
  1. premdesai says:

    From the MS Lync client how can i come to know, how much contact limit is applied on te system/user ?

  2. CSPShell says:

    Hey Prem,

    Unfortunately, as far as we can tell there is no way to discover this information from the client machine.

  3. k.yogesh@live.com says:

    is there a way to limit contacts appearing in "Frequent contacts" List on the Lync Client?

  4. Franck says:

    Hello,

    It's the same thing for RGS ?

Comments are closed.

Skip to main content