Partager via


Haiku #174

It's like magic but

Better. That can only be

Simple URLs.

 

Hello everyone, and welcome to the Lync Server PowerShell haiku of the day. Today's topic: the Test-CsCertificateConfiguration cmdlet!

 

Whoa, hey, take it easy: we were just kidding. Trust us, we haven't forgotten that, in yesterday's haiku, we promised that today's haiku would be about the New-CsSimpleUrl cmdlet. We were just having a little fun with you, sort of like – after the first Harry Potter book was published – J. K. Rowling announced that her next book would be a scientific treatise on the digestive system of the common North American earthworm.

 

Note. No, J. K. Rowling did not announce that her next book would be a scientific treatise on the digestive system of the common North American earthworm; she's way too smart for that. As it turns out, she might also be smarter than the authors of the Lync Server PowerShell blog. Although few people know this, the authors of the Lync Server PowerShell blog were the original choices to write the Harry Potter books. They declined the offer, however, believing that a daily haiku about Lync Server PowerShell would appeal to a much wider audience, would be easier to translate into movies, action figures, and theme park rides, and would end up being far more popular and far more profitable. Regrets? None. After all, the Harry Potter series is finished, but the daily haiku goes. We'll see who has the last laugh.

 

To briefly recap yesterday's haiku (and set the stage for today's haiku), 24 hours ago we noted that the process of creating simple URLs was really a three-step process. (And what exactly is a simple URL? See yesterday's haiku for details.) To create a simple URL you need to:

 

1. Specify the actual URL (e.g., https://meet.litwareinc.com) that will be used for online meetings. That's done by using the New-CsSimpleUrlEntry cmdlet.

2. Create a simple URL that, among other things, references the URL you just created. The simple URL is created using the New-CsSimpleUrl cmdlet, which we'll talk about in a few minutes.

3. Add the newly-created simple URL to a collection of simple URLs (something which we discussed a long, long time ago).

 

Or, if you prefer code over blather (hint: if you do, you've come to the wrong place):

 

$urlEntry = New-CsSimpleUrlEntry -Url "https://meet.fabrikam.com"

 

$simpleUrl = New-CsSimpleUrl -Component "meet" -Domain "fabrikam.com" -SimpleUrl $urlEntry -ActiveUrl "https://meet.fabrikam.com"

 

Set-CsSimpleUrlConfiguration -Identity "site:Redmond" -SimpleUrl @{Add=$simpleUrl}

 

In today's haiku we're going to focus on this line of code (which, in our opinion, is better PowerShell code than you'll find in any of the Harry Potter books, including Harry Potter and the Half-Blood Prince!):

 

$simpleUrl = New-CsSimpleUrl -Component "meet" -Domain "fabrikam.com" -SimpleUrl $urlEntry -ActiveUrl "https://meet.fabrikam.com"

 

Before we discuss this command in any detail, let's talk about the three kinds of simple URLs that Lync Server allows you to create:

 

· Meet – Provides simple URLs for online meetings. You must have at least one Meet URL for each of your SIP domains.

· Admin – Provides a simple URL for the Lync Server 2010 Control Panel.

· Dialin – Provides a simple URL for the Dial-in Conferencing Web page.

 

The Admin and Dialin simple URLs are optional; if you don't bother to create a simple URL for Dialin, users will still be able to access the Dial-in Conferencing Web page; they just won't be able to do so using a URL like https://dialin.fabrikam.com. However, the Meet URL is a different story. When you install Lync Server, no simple URLs are pre-created for you; you have to create all these URLs yourself. Suppose you decide to skip the Meet URL and create just an Admin URL instead. Here's what will happen when you try to add that URL to a simple URL collection:

 

Set-CsSimpleUrlConfiguration : There must be an Active URL for Meet for each SIP Domain.

 

And before you ask, no, there's absolutely no way around that. You must create a Meet simple URL before you can create any other simple URLs. And, as we noted yesterday, you must have a simple URL for each of your SIP domains. Otherwise you're going to run into problems.

 

Oh, and as long as we're on the subject, every simple URL you create must point to a real, live SIP domain. Suppose you decide to create a few simple URLs now, and then figure you'll create the corresponding SIP domains later. Is that going to work? Nope:

 

Set-CsSimpleUrlConfiguration : Simple URL cannot be specified for a nonexistent SIP Domain. Please add the SIP Domain first.

 

OK, let's go back to our New-CsSimpleUrl command:

 

$simpleUrl = New-CsSimpleUrl -Component "meet" -Domain "fabrikam.com" -SimpleUrl $urlEntry -ActiveUrl "https://meet.fabrikam.com"

 

As you can see, when we call New-CsSimpleUrl we need to first specify the type of URL we are creating (the Component) as well as the URL domain (in this example, fabrikam.com). We also need to include the SimpleUrl parameter followed by the simple URL entry (Web address) that we created using the New-CsSimpleUrlEntry cmdlet. If you've forgotten about that command, it looks a lot like this:

 

$urlEntry = New-CsSimpleUrlEntry -Url "https://meet.fabrikam.com"

 

Finally, we need to indicate which simple URL is the active URL, the URL that will actually be employed by your users. A simple URL can contain multiple URLs, but only one of those URLs can be active at any time.

 

If all goes well, we'll end up with a new Meet URL in (in this case) the Redmond site:

 

Identity : site:Redmond

SimpleUrl : {Component=meet;Domain=fabrikam.com;ActiveUrl=https://meet.fabrikam.com}

 

And what if we wanted to create all three simple URL types, and all three at the same time? No problem:

 

$urlEntry = New-CsSimpleUrlEntry -Url "https://meet.fabrikam.com"

$simpleUrl = New-CsSimpleUrl -Component "meet" -Domain "fabrikam.com" -SimpleUrl $urlEntry -ActiveUrl "https://meet.fabrikam.com"

 

$urlEntry2 = New-CsSimpleUrlEntry -Url "https://admin.fabrikam.com"

$simpleUrl2 = New-CsSimpleUrl -Component "admin" -Domain "fabrikam.com" -SimpleUrl $urlEntry2 -ActiveUrl "https://admin.fabrikam.com"

 

$urlEntry3 = New-CsSimpleUrlEntry -Url "https://dialin.fabrikam.com"

$simpleUrl3 = New-CsSimpleUrl -Component "dialin" -Domain "*" -SimpleUrl $urlEntry3 -ActiveUrl "https://dialin.fabrikam.com"

 

Set-CsSimpleUrlConfiguration -Identity "site:Redmond" -SimpleUrl @{Add=$simpleUrl,$simpleUrl2,$simpleUrl3}

 

Just a couple things to note about these commands. As you can see, we had to create separate URL entries and simple URLs for each component: Meet, Admin, and Dialin. And then when we called the Set-CsSimpleConfiguration cmdlet, we simply had to specify all three of the variables containing the simple URLs. In other words:

 

Set-CsSimpleUrlConfiguration -Identity "site:Redmond" -SimpleUrl @{Add= $simpleUrl,$simpleUrl2,$simpleUrl3}

 

It's not hard, it's just something you need to watch out for.

 

Oh, and here's something else to watch out for: always use the Add method when adding a new simple URL:

 

Set-CsSimpleUrlConfiguration -Identity "site:Redmond" -SimpleUrl @{Add=$simpleUrl}

 

Why does that matter? Well, that will add a new URL to your collection. This syntax is perfectly valid:

 

Set-CsSimpleUrlConfiguration -Identity "site:Redmond" –SimpleUrl $simpleUrl

 

However, that syntax will replace all your existing simple URLs with the one URL contained in the variable $simpleUrl. If that's what you want to do, well, then go for it. But if you just wanted to add $simpleUrl to the collection, make sure you do it like this:

 

Set-CsSimpleUrlConfiguration -Identity "site:Redmond" -SimpleUrl @{Add=$simpleUrl}

 

Needless to say, that's a lesson some of us learned the hard way.

 

That's pretty much all for today. We've got to go change clothes and head off to a meeting with a representative from Disney. You just wait, J. K. Rowling: Lync Server PowerShell World isn't dead yet. Not by a long shot.