Make This a Priority

Whether we realize it or not, we prioritize just about everything we do throughout the day. It starts when we wake up in the morning: Do I sleep a little longer or do I get up so I can get to work on time? (That’s probably the toughest one right there.) When we get to work, is it more important to start answering those emails that came in overnight, or to get a cup of coffee so that our email answers are comprehensible? And which of those emails should we answer first?


This continues endlessly all day. Most of the time we don’t think too hard about those decisions and which task we need to do first – sometimes it’s pretty obvious. (Get the coffee first.) But when it comes to Windows PowerShell in Lync Server 2010, there are some decisions about priority we might want to give some serious thought to. For example, if a caller dials an unassigned number that falls within more than one unassigned number range, which announcement do we play? Or if a dialed number matches the pattern for more than one voice route, which route do we want the call to take? And of course the biggest question of all: How do we tell Lync Server how to prioritize these things?


That last question is easy, so we’ll answer that first, then go over some examples so you can see how this all works. The answer to “How do we tell Lync Server how to prioritize these things?” is this: set the Priority parameter of the appropriate cmdlet. Here’s a list of cmdlets that have a Priority parameter:


·         New-CsClientVersionPolicyRule

·         Set-CsClientVersionPolicyRule

·         New-CsOutboundTranslationRule

·         Set-CsOutboundTranslationRule

·         New-CsServerApplication

·         Set-CsServerApplication

·         New-CsSipResponseCodeTranslationRule

·         Set-CsSipResponseCodeTranslationRule

·         New-CsUnassignedNumber

·         Set-CsUnassignedNumber

·         New-CsVoiceNormalizationRule

·         Set-CsVoiceNormalizationRule

·         New-CsVoiceRoute

·         Set-CsVoiceRoute

·         Set-CsDialInConferencingAccessNumber


How the Priority Parameter Works


The Priority parameter works the same (okay, mostly the same) no matter which cmdlet you use it with. We’ll start by explaining how to set and change the value, then we’ll talk about what it actually means to do that. We’re going to use the CsVoiceRoute cmdlets to walk you through this general discussion, then get into the specifics of the various other cmdlets.


The first time you call New-CsVoiceRoute to create a new route, that route will be given the Priority 0. For example, run this command to create a new voice route:


New-CsVoiceRoute -Identity Route1 -PstnUsages @{add="Local"} -PstnGatewayList @{add=""} -NumberPattern '^(+1[0-9]d+)$'


Here’s the new voice route object created by that command:


Identity: Route1

Priority: 0


NumberPattern: ^(+1[0-9]d+)$

PstnUsages: {Local}

PstnGatewayList: {}

Name: Route1




In this example we didn’t use the Priority parameter to explicitly set the priority. Since there were no other voice routes defined, the Priority was automatically set to 0.


Note. Your system may already have a default voice route in place. If that’s the case, the new route you just created will have a Priority value of 1. We’ll explain that next.


Now let’s create another route:


New-CsVoiceRoute -Identity Route2 -PstnUsages @{add="Long Distance"} -PstnGatewayList @{add=""} -NumberPattern '^(+1[0-9]{7})$'


Here’s the object created by this command:


Identity: Route2

Priority: 1


NumberPattern: ^(+1[0-9]{7})$

PstnUsages: {Long Distance}

PstnGatewayList: {}

Name: Route2




Notice the Priority value of this route. The first route created received a default Priority value of 0; the second route received a default Priority value of 1.


That seems pretty simple, right? But what happens if we create another voice route, but this time we set the Priority to 0? Let’s try it:


New-CsVoiceRoute -Identity Route3 -PstnUsages @{add="Local","Long Distance"} -PstnGatewayList @{add=""} -NumberPattern '^011(d{7}d+)$' –Priority 0


Here’s what Route3 looks like. (We’ll show only the Identity and Priority to keep things a little less cluttered. The rest isn’t important right now anyway. It will be in a few minutes, but it isn’t right now.)


Identity: Route3

Priority: 0


Notice that the Priority is set to 0, just like we specified in the command. But remember, Route1 already had a Priority of 0. Well, guess what? It doesn’t anymore. Here’s what we see when we call Get-CsVoiceRoute:


Identity: Route3

Priority: 0


Identity: Route1

Priority: 1


Identity: Route2

Priority: 2


Take a look at the Priority values of Route1 and Route2. Here’s what the Priority values looked like before and after we created Route3:



Priority Before

Priority After












When we set Route3 to have a Priority of 0, the Priority values of Route1 and Route2 were automatically incremented to move them down in the priority list.


Don’t you wish it was that easy to set the priorities of your son’s baseball game, your daughter’s soccer game, and your dentist appointment, which all happen to be at the same time?


Let’s look at another example. This time we’re going to try changing the priority on an existing voice route. Suppose we want to make sure that Route3 always has the lowest priority (keeping in mind that the higher the Priority value, the lower the priority). We’re going to do this by setting the Priority value of Route3 to 9:


Set-CsVoiceRoute -Identity Route3 -Priority 9


Skip to main content