How can we turn that

Frown upside down? Try running

Test Registration.

 

Hello, and welcome to the 93rd edition of the Lync Server PowerShell daily haiku. Today we had planned on talking about the other Lync Server PowerShell blog author and her propensity for being grouchy all the time. [Note from that other author: Not all the time.] However, we can't do that: after all, she has turned over a new leaf, and has taken a vow to remain upbeat and positive from now on. So much for that plan.

 

Note. How long do we expect that new attitude to last? Let's put it this way: we're already working on tomorrow's haiku.

 

In the meantime, we still have to write today's haiku, and so we decided to focus on the fact that today is the 93rd daily haiku in our series of Lync Server PowerShell daily haikus. (Yes, we know: times does fly when you're having fun, doesn't it?) As it turns out, the number 93 is very significant and has a lot of deep meaning; for example, Wikipedia notes that the number 93 is "… the natural number following 92 and preceding 94." See what we mean? Not only that, but the aliquot sum of 93 is "… 35 within the aliquot sequence (93,35,13,1,0) 93 being the fourth composite number in the 13-aliquot tree"!

 

Hey, would we kid you about something like that?

 

Note. What do you mean "What's an aliquot sum?" OK, on the off-chance that there are a few people out there who don't know what an aliquot sum is (yes, you should be embarrassed), an aliquot sum is …hang on a second here … oh, it's the sum of all the divisors of a number. (What else would it be?) 93 can be divided by 1, 3, and 31; add those together and you get an aliquot sum of 35:

 

1 + 3 + 31 = 35

 

This is interesting because … well, just because, OK?

 

All right, let's see, what else we can talk about? Well, 93 is the 47th odd number; that's pretty exciting. Oh, and 93 is the product of the 2nd and the 11th prime numbers: 3 x 31 = 93! And – ah, never mind. To tell you the truth, these haikus were a lot easier to write back in the days when the other blog author was grouchy all the time.

 

On the other hand, now that she has vowed to be upbeat and positive we should help her out by discussing something that's really upbeat and positive: the Test-CsRegistration cmdlet. What's so great about Test-CsRegistration? Well, for one thing, the aliquot sum of Test-CsRegistration is 35 within the aliquot sequence (93,35,13,1,0), 93 being the fourth composite number in the 13-aliquot tree. Perhaps more important than that (hey, we said perhaps), Test-CsRegistration is an example of a synthetic transaction cmdlet that enables you to verify that users can log on to Microsoft Lync Server 2010.

 

Is that useful? You bet it is. For example, let's assume you've created some health monitoring test accounts for a Registrar pool; if you aren't sure what health monitoring test accounts are, see this daily haiku for more information.

 

Note. Does Microsoft know that any time we want to point people to more information we point them to some crazy haiku rather than some official product documentation? Apparently not.

 

At any rate, if you have set up health monitoring test accounts for a pool you can periodically run a command like this one to verify that users can log on to that pool:

 

Test-CsRegistration -TargetFqdn atl-cs-001.litwareinc.com

 

It really is that simple. In this case, Test-CsRegistration will attempt to sign on to Lync Server using one of the test accounts and then, if successful, will attempt to log off from the system. If all goes well, you'll get back a report similar to this:

 

TargetFqdn : atl-cs-001.litwareinc.com

Result     : Success

Latency    : 00:00:02.4850725

Error      :

Diagnosis  :

 

And what if things don't go well? Then you'll get back a report like this:

 

TargetFqdn : atl-cs-001.litwareinc.com

Result     : Failure

Latency    : 00:00:00

Error      : 404, Not Found

Diagnosis  : ErrorCode=4005,Source=atl-cs-001.litwareinc.com,Reason=Destination URI either not enabled for SIP or does not exist

 

In this case, we got the error because we tried using a test account that doesn't actually exist.

 

Speaking of which, here's a quick tip. If you do get an error, you might want to rerun the command using the Verbose parameter:

 

Test-CsRegistration -TargetFqdn atl-cs-001.litwareinc.com -Verbose

 

When you do that, Test-CsRegistration will give you a step-by-step account of everything it's trying to do. In our case, that included the following report:

 

User Sip Address = sip:tester@litwareinc.com

Registrar Port = 5061.

Auth Type 'IWA' is selected.

An exception 'The endpoint is unable to register. See the ErrorCode for specific reason.' occurred.

 

That tells us that the problem was with the account sip:tester@litwareinc.com.

 

Test-CsRegistration can also be run under the credentials of an actual user account (as opposed to the credentials of a test user). Suppose Ken Myer calls and says he can't log on to Lync Server. If you know Ken's SIP address, and if you know Ken's password, you can use a pair of commands like this to test Ken's ability to log on to Lync Server:

 

$cred1 = Get-Credential "litwareinc\kenmyer"

 

Test-CsRegistration -TargetFqdn atl-cs-001.litwareinc.com -UserCredential $cred1 -UserSipAddress "sip:kenmyer@litwareinc.com" -Verbose

 

Note that we added the Verbose parameter when we called Test-CsRegistration. That way, if the command does fail and Ken is unable to logon, we should get some pretty good insight into why he is unable to logon.

 

And there you have it: Test-CsRegistration. Is it a cmdlet we should have written about a long time ago? Probably; after all, it's a useful cmdlet to know about, and, had we written about it months ago, the other blog author wouldn't have had any reason to be grouchy. Oh, well, better late than never, right? 93!

 

Note. For followers of Thelema, 93 means "Do what thou wilt shall be the whole of the Law." That's calculated by – well, we'll let you do the calculations yourself. In the meantime, we're going to start up an office pool to see how long it is before the other blog author stops being upbeat and positive. We're betting that will be right about the time she starts to read today's haiku.

 

Although, come to think of it, that seems to happen to her every time she reads one of the daily haikus. Must be a coincidence.