May 13, 2016 — Day 34: Update-CsPool Script

I’ve started working on yet another stupidly complicated script — largely because it will make my life a lot easier. This one has a lot of work left to do, its in much rougher shape than my ADFS script, and a lot more can go wrong with this one. One of the nice things about the ADFS script was that, although it had a lot of options, each option was largely simple and required only a few commands. This Update-CsPool PowerShell script is different in that it has very few options for the user to worry about, but it needs to do a lot of stuff with the small amount of input it does receive. This can be quite tricky, so I need to make sure I handle errors a bit more clearly than in some of my previous work. This script also has the ability to stop production Skype for Business Server services, reboot servers, and bring things back into service. That is pretty dangerous since it could result in user service interruption and outages. So, I have to tread carefully.

The script does a few things in very specific order:

  1. Asks the user to enter the name of the Skype for Business Server 2015 Front-End pool the script should run against
  2. Generates a list of all the servers in the pool
  3. Makes sure that the local machine the script is being run on is not in the pool (since the servers in the pool may be rebooted later)
  4. Starts with the first server and fails over services
  5. Waits for all the services to be stopped
  6. Downloads and imports this PowerShell module for managing Windows Updates:
  7. Installs Windows Updates
  8. Checks if the server needs a reboot and reboots it if it does. It skips the reboot if the registry entry indicating that a reboot is required is missing.
  9. Waits for the server to reboot
  10. Fails services back and waits for them to all start
  11. Begins over again at step 4 with the second server

It goes on like that until it has updated (and maybe rebooted) all servers in the Front End pool. The script is missing a lot unfortunately, and doesn’t seem to behave very well depending on how long it takes services to stop. I’ll have to do some more testing, but I’m hopeful that I can get this thing to a state where its useful. The main reason I started writing this was to save me some headache when handling patching in customer environments, especially ones where they have more than one Front-End pool. Eventually I’d love to add extra functionality to patch other Skype for Business components besides Front-End servers, but I had to start somewhere.

Here is the most of up to date version of the script I’m ready to share. I will hopefully have some nice updates to this available in the next few weeks:

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.