Haiku #176

Port 8061?

That's unacceptable! Set

CS Web Server.

 

For those of you who've been keeping track, the author of today's haiku has now worked for eight consecutive days. (That's right, eight!) That can only mean one thing: it's time for him to take a few days off.

 

Note. How did the author of today's haiku manage to work for eight straight days before he felt like he needed to take a few days off? Really, it was no big deal: that just demonstrates how truly dedicated and devoted he is to his job.

 

At any rate, as the author of today's haiku pursues the vacation part of his vacation/work-remotely, that means that this will be the last Lync Server PowerShell haiku of the day until Thursday, August 25th. Originally, we were going to do one those good news/bad news things here. But when we told people that there would be more daily haikus starting next Thursday they told us they couldn't help us come with the good news part.

 

There were, however, plenty of suggestions for the bad news part.

 

As you might expect, any time you leave for vacation there are plenty of things to do: stop the newspaper delivery; put plenty of food out for the cat; make sure all the house plants have been watered. Of course, because the author of today's haiku is already on vacation (you know you're getting lazy when you feel the need to take a vacation from your vacation) he didn't have to do any of those things. Therefore, he decided to do the one thing that vacation-goers always want to do before they leave, but never seem to have time for: he decided to write a haiku about the Set-CsWebServer cmdlet.

 

Although, to be perfectly honest, there really isn't much to say about Set-CsWebServer. As is the case with most of the server role cmdlets (like, say, Set-CsApplicationServer), Set-CsWebServer is a pretty simple little cmdlet: its primary purpose is to enable you to specify the ports used for various types of Web traffic. For example, one of the protocols used by Lync Server Web servers is the PSOM (Persistent Shared Object Model) protocol; this protocol is used for Web conferencing content such as conference ID, security keys, expiration time, and user roles and privileges. By default, the PSOM protocol uses port 8061 for anyone connecting to a conference from outside your organization's firewall. But suppose port 8061 won't work for you; suppose you need to change that to port 8062? Hey, all you had to do was ask:

 

Set-CsWebServer -Identity "WebServer:atl-cs-001.litwareinc.com" –ReachExternalPsomServerPort 8062

 

That's all you have to do. Want to change both the HTTP and HTTPS ports for your internal users? Hey, why not? After all, that's as easy as this:

 

Set-CsWebServer -Identity "WebServer:atl-cs-001.litwareinc.com" –PrimaryHttpPort 81 –PrimaryHttpsPort 444

 

The only even remotely tricky part about using the Set-CsWebServer cmdlet crops up when you want to configure ports for application sharing; this is tricky simply because you can configure a range of ports for application sharing. (If you do that, then any time someone shares an application, Lync Server will dynamically choose one of the ports in that range.) By default, Lync Server sets aside 16,383 ports for application sharing, starting with port 49152 and continuing on from there. You say you don't like that? You say that you'd rather start at port 50000 and set aside 6000 ports for application sharing? That's fine; all you have to do is call Set-CsWebServer and specify the initial port (50000) and the total number of ports to be used for application sharing (6000). In other words:

 

Set-CsWebServer -Identity "WebServer:atl-cs-001.litwareinc.com" –AppSharingPortStart 50000 –AppSharingPortCount 6000

 

If you do the math, that means ports 50000 through 55999 (a total of 6000 ports) will be reserved for application sharing.

 

Note. As usual, your range of ports must be a continuous range of ports: you can't allocate, say, ports 50000 through 52000 and ports 54000 through 56000. That just plain won't work. Also, your port range should have at least 100 ports in it, meaning that the AppSharingPortCount should never be set to anything less than 100.

 

Actually, now that we think about it, there are a couple of other slightly-tricky aspects to the Set-CsWebServer cmdlet. For example, how did we know that the default port used for PSOM traffic is port 8061? Well, for one thing, we are highly-trained and highly-skilled Microsoft professionals.

 

OK, we didn't really expect anyone to buy that. To be honest, we simply ran to the Get-CsService cmdlet (along with the WebServer parameter) to retrieve that information:

 

Get-CsService –WebServer

 

That's going to return all sorts of information about your Web servers, including the current port settings.

 

Note. Why didn't we just run the Get-CsWebServer cmdlet? That's easy: because there isn't a Get-CsWebServer cmdlet. We don't really know for sure why, but hundreds of years ago Microsoft decided the Get-CsService cmdlet would be used to return information about most of the Lync Server services and server roles. There would be separate Set-Cs cmdlets for configuring these services and server roles, but just one cmdlet (with a whole bunch of parameters) that would be used to retrieve information about these same components.

 

The other thing that can be a little tricky is the fact that you can't directly pipe objects to the Set-CsWebServer cmdlet. Big deal, you say? Well, it can be. For example, suppose you wanted to set the PrimaryHttpPort for all your Web servers to port 81. This command won't cut it:

 

Get-CsService –WebServer | Set-CsWebServer –PrimaryHttpPort 81

 

Instead, you'll get the following error message:

 

Set-CsWebServer : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.

 

If you want to set multiple Web servers with a single command, you'll need to pipe the data to the ForEach-Object and then let ForEach-Object call the Set-CsWebServer cmdlet.

 

You seem a bit confused. Maybe it would help if we showed you an example:

 

Get-CsService –WebServer | ForEach-Object {Set-CsWebServer –Identity $_.Identity –PrimaryHttpPort 81}

 

All we've done here is use the Get-CsService cmdlet (and the WebServer parameter) to retrieve a collection of all our Lync Server Web servers. We've then piped that data to the ForEach-Object cmdlet, which takes each Web server in the collection, grabs the Identity of that Web server ($_.Identity) and then uses Set-CsWebServer to change the HTPP port. It might look a little confusing at first, but think about it for a second and you should see what it's doing, and why.

 

As for what we're doing, we're taking a few days off. And why are doing that? Do you even have to ask?

 

See you next week.