Home > Lync Server/Skype for Business Server > Script: Set-CsFeatures.ps1 – Easily Install Prerequisites and Tools for Lync Server 2013 and Skype for Business Server 2015

Script: Set-CsFeatures.ps1 – Easily Install Prerequisites and Tools for Lync Server 2013 and Skype for Business Server 2015


Installing Skype for Business and Lync servers is usually boring if you’re a consultant who does it often. Making sure the server specs are right, installing OS features, configuring NICs, etc. It’s even more boring if you’re building a bunch of servers at one time. There’s always a chance for human error, too. So why not automate as much as possible? That’s what I was after when I built the Lync Server 2010 prereq script, then the Lync Server 2013 prereq script. And it’s certainly what I’m after for Skype for Business Server 2015. This time, however, I opted to not have a separate script for Skype for Business. Many of the requirements are the same, or just slightly different, than Lync Server 2013. So I just added the Skype for Business functionality to the 2013 script, and updated everything as a whole.

When calling the script, one only needs to specify the –Skype4b switch to put the script into “Skype for Business mode”. Not specifying that switch cause a pop-up to appear, asking what mode you’d like. The menus don’t change based on what mode the script is in. Options for only one platform are clearly noted. Otherwise, the options automatically adjust for the platform you’ve chosen. The menu starts out with core prerequisite options for common Lync/SfB roles, followed by Microsoft tools and resources, some third-party tools and options, and then some sub-menus. Sub-menus are broken down by Misc server config, Desktop shortcuts, Taskbar shortcuts, Downloads, and Security options. As you can see, there are TONS of options. I’m not going to list every menu and option here, as the nature of the script means I’ll be adding/updating things as people request them, or as vendors update/alter their offerings. Just note that the options from the 2013 script have been moved around a little bit as I try to keep things organized.

This version also uses my new method of checking for updates, as mentioned in Function: Get-UpdateInfo – Making It Easy for Your Users to Get the Latest Version of Your Scripts. When a new version is available, you’ll get a pop-up notifying you.

If you’re aware of a third-party product, or even Microsoft product, that is a good match for Skype for Business servers, let me know. I’m happy to take a look and see if it would make a good addition to the script.

Super big thanks to my beta testers for supplying bug reports, suggestions, and comments.


C:\Set-CsFeatures.ps1 [-TargetFolder <String>] [-WindowsSource <String>] [-SQLPath <String>] [-InitialMenuOption <Int32>] [-IncludeSSMS ] [-IncludeTelnet ] [-IncludeFW ] [-IncludeHighPower ] [-IncludeStandard ] [-GetInfoFromRegistry ] [-OWASOveride ] [-DownloadOnly ] [-SkipCoreCheck ] [-Tail ] [-Skype4b ] [-SkipUpdateCheck ] [-DisableAutoUpdates ] [-IncludeLanguagePack ] [-SkipEdgeNicConfig ] [-WhatIf ] [-Confirm ] [-IncludeTotalCount ] [-Skip <UInt64>] [-First <UInt64>] [<CommonParameters>]

C:\Set-CsFeatures.ps1 [-TargetFolder <String>] [-GetInfoFromRegistry ] [-OWASOveride ] [-DownloadAll ] [-SkipCoreCheck ] [-Tail ] [-Skype4b ] [-WhatIf ] [-Confirm ] [-IncludeTotalCount ] [-Skip <UInt64>] [-First <UInt64>] [<CommonParameters>]

C:\Set-CsFeatures.ps1 [-GetInfoFromRegistry ] [-ClearRunningStatus ] [-WhatIf ] [-Confirm ] [-IncludeTotalCount ] [-Skip <UInt64>] [-First <UInt64>] [<CommonParameters>]

C:\Set-CsFeatures.ps1 [-GetInfoFromRegistry ] [-Skype4b ] [-WhatIf ] [-Confirm ] [-IncludeTotalCount ] [-Skip <UInt64>] [-First <UInt64>] [<CommonParameters>]


.\Set-CsFeatures.ps1 -Skype4b

Runs script in Skype for Business mode. Options chosen while running in this mode are tailored to Skype for Business. Not specifying this option will cause a pop-up prompt when the script starts, allowing a user to choose the desired mode.


Runs script with default values.

.\Set-CsFeatures.ps1 -WindowsSource "d:"

Runs script with the location defined for the Windows Server 2012/2012 R2 installation files.

.\Set-CsFeatures.ps1 -SQLPath "d:\sqlexpress"

Runs the script and installs any required SQL Express instances in the specified location.

.\Set-CsFeatures.ps1 -TargetFolder "d:\installbits"

Runs the script, and saves any downloaded files and written logs in the specified location instead of the default “c:\_install”.

.\Set-CsFeatures.ps1 -InitialMenuOption 3

Runs the script, and automatically starts option 3 (Front End server). Once it’s finished with that option, the script functions as normal, and displays the menu. NOTE: only options from the main menu can be specified. Options in sub-menus are not available with -InitialMenuOption.

.\Set-CsFeatures.ps1 -tail

Runs script with default values, but also shows an additional PowerShell window showing a live running log file.



Defines the location for any downloaded files. Defaults to “c:\_install”. Additionally, log files generated by this script are located in a sub-folder of TargetFolder called “logs”. TargetFolder does not support paths with spaces, but does support non-hidden UNC paths.


Defines the location of the Windows Server installation files. This is needed to install .Net 3.5 since those files are not installed on the server by default. Defaults to first detected CD-ROM/DVD drive. This can be a local file path, path to an .ISO file, or a non-hidden UNC path.


Defines the desired installation path for SQL Express. Defaults to “c:\Program Files\Microsoft SQL Server”.


Allows you to start the script with the option you want, without first displaying the menu.


If specified, will include SQL Server Management Studio automatically when prerequisites are installed for any server that has SQL Express instances. If not specified, a prompt will appear.


If specified, will include Telnet automatically when prerequisites for Front End servers, Director servers, Mediation servers, Edge servers, and/or Persistent Chat servers are installed. If not specified, a prompt will appear.


If specified, will include the firewall rules for Get-CsConnections automatically when prerequisites for Front End servers are installed. If not specified, a prompt will appear.


If specified, tells the script to automatically set the Power Config on the server to High Power. This is instead of the script prompting. This option is available for all server roles.


If specified, tells the script to include the extra SQL Express instance required for Standard Edition front end servers. This is instead of the script prompting.


This value is only used during mid-prereq reboots. It is automatically set and read by the script, and should never be manually specified.


Don’t use this parameter. It’s for internal testing only. Using it can render the server unusable.


Tells this script to not install or configure anything – just download the files. This is useful if you’re going to be building servers that do not have Internet access and want to fetch the files beforehand. The big difference between this option and -DownloadAll, is that this option presents the normal menus, and allows you to download files for the options you pick. The -DownloadAll option downloads ALL files needed for ALL options.


Tells this script to not install or configure anything – just download ALL of the files. This is useful if you’re going to be building servers that do not have Internet access and want to fetch the files beforehand from a desktop computer. The big difference between this option and -DownloadOnly, is that this option downloads ALL files needed for ALL options, whereas -DownloadOnly allows a user to download files for specific options they choose.


This switch forces the running status to be reset. This option should ONLY be used if the script exits/aborts dirty, and attempts to run the script again yield a “Script is already running” message.


When specified, skips the check for Server Core. It is not meant to be called manually, as it’s used when the script needs to restart after a server reboot.


When specified, opens another PowerShell session and tails the log file, similar to *nix. This is really only beneficial during troubleshooting.


When specified, uses values specific to Skype For Business Server 2015 for prerequisites. If this option is NOT specified a pop-up will appear, asking which mode the script should operate in: Lync Server 2013 or Skype for Business Server 2015.


When specified, skips the check for a newer version of the script. This option is included mainly for when the script reboots the server.


When specified, skips the prompt and automatically disables auto updates for Windows Server. If not specified, a prompt is displayed.


When specified, skips the prompt for the installation of the Office Online Server English language pack. If not specified, a prompt is displayed.


When specified, skips the configuration of the NICs on edge servers. This requires that you manually complete those steps.


No installation is necessary.

Execution Policy: Third-party PowerShell scripts may require that the PowerShell Execution Policy be set to either AllSigned, RemoteSigned, or Unrestricted. The default is Restricted, which prevents scripts – even code signed scripts – from running. For more information about setting your Execution Policy, see Using the Set-ExecutionPolicy Cmdlet.


I’ve never been one to really solicit donations for my work. My offerings are created because *I* need to solve a problem, and once I do, it makes sense to offer the results of my work to the public. I mean, let’s face it: I can’t be the only one with that particular issue, right? Quite often, to my surprise, I’m asked why I don’t have a “donate” button so people can donate a few bucks. I’ve never really put much thought into it. But those inquiries are coming more often now, so I’m yielding to them. If you’d like to donate, you can send a few bucks via PayPal at https://www.paypal.me/PatRichard. Money collected from that will go to the costs of my website (hosting and domain names), as well as to my home lab.

Known Issues

The only issue I’m aware of at the release of the latest version is that pinning shortcuts to the taskbar in Windows Server 2016 doesn’t seem to be working. If you come across something, please let me know. Contact info is in the header of the script, and the script also has option 96, ‘how to report a bug’ that will tell you what information is critical when reporting a problem.

Frequently Asked Questions

Question: Does this script support Windows Server 2016?

Answer: Yes – starting with version 4.20, prerequisites for Windows Server 2016 are included.

Question: Why doesn’t this script support Windows Server 2008 R2 and earlier?

Answer: I get asked this all the time. There are several reasons. The first is that out of the box, Server 2008 R2 has PowerShell 2.0 installed, and this script is written in PowerShell 3.0. Requiring you to upgrade to PowerShell 3.0 first, before running a script that installs prerequisites, seems counter-intuitive. And converting the script to just use PowerShell 2.0 is taking a step backwards, especially considering that the current version of PowerShell is 5.0, and even as this is written, 5.1 is in preview.

Next is sheer time. I test changes I make. And then I test them again. And then I choose different options and combinations and test them. Testing on just Server 2012 and Server 2012 R2 is exhausting. Adding Server 2008 R2 would mean even more testing, plus I’d have to add those resources in my already overtaxed test labs. That would slow down my ability to add new features and test fixes.

Third is that Server 2008 R2 is three versions back. Get with the times already!

Question: Does the script support Windows Server 2016?

Answer: No, and the primary reason is that Lync Server 2013 and Skype for Business Server 2015 are not supported on Windows Server 2016. Once they are supported on Windows Server 2016 (and it will likely only be Skype for Business Server 2015 that’s supported), I’ll adjust the script as needed. I’ve already done some preliminary work.

Question: Can you add feature x?

Answer: I LOVE getting feature requests. Seriously! Best method to suggest features is to send me an email. My email address is in the comment section at the top of every script I publish. Please be detailed in what you’d like to see, as well as any scenarios you’d use the option (so I can try to duplicate testing). This also goes for additional tools, whether Microsoft or third-party.

Question: How do I submit bug reports?

Answer: Email is best. Grab my email address from the comment section at the top of the script. Please be VERY detailed. Please include screen shots if possible, and ALWAYS include the log file. If the script will start, select option 96, “Report a bug/problem with this script”. If you’re not using the latest version of the script, please download it from the Downloads section below and see if you can duplicate the problem before reporting it.

Question: What if my server doesn’t have Internet access?

Answer: Fear not. Download the required files using either the -DownloadOnly or -DownloadAll options from another machine and place them in the TargetFolder, which is c:\_install by default. The script looks to see if the file is available locally before attempting to download. An exception to this is the latest cumulative update, which is always downloaded, since the URL and file name don’t change, even when the version does.

Question: When I run the script again, I get “Script already running”

Answer: This is because the script didn’t exit gracefully. Many reasons this can happen, such as rebooting the server while it’s still running. If you’re positive it’s not running anywhere else (including by other users logged into the same server), run the script with the -ClearRunningStatus switch to clear that flag. Then run it as normal.

Question: Is there an option to specify where (i.e. path) all of the various tools are installed?

Answer: No. And not for a lack of trying. Some tools don’t support automated installs with a specified path. And some of those that DO, actually still dump some core files in a “default” location. The more I tried to come up with the solution, the more I realized that it would entail a substantial amount of overhead in the script.

Question: Why does the script report an unsupported version of .NET Framework?

Answer: Because Lync Server 2013 and Skype for Business Server 2015 don’t support the version detected. Once they do, I’ll adjust the script accordingly.


v4.30 – 10-11-2017 – Set-CsFeatures.v4.30.zip

v4.20 – 09-04-2017 – Set-CsFeatures.v4.20.zip

v4.10 – 05-15-2017 – Set-CsFeatures.v4.10.zip

v4.09 – 05-13-2017 – Set-CsFeatures.v4.09.zip

v4.08 – 04-19-2017 – Set-CsFeatures.v4.08.zip

v4.07 – 04-14-2017 – Set-CsFeatures.v4.07.zip

v4.06 – 02-05-2017 – Set-CsFeatures.v4.06.zip

v4.05 – 11-04-2016 – Set-CsFeatures.v4.05.zip

v4.04 – 11-02-2016 – Set-CsFeatures.v4.04.zip

v4.03 – 11-01-2016 – Set-CsFeatures.v4.03.zip

v4.02 – 10-28-2016 – Set-CsFeatures.v4.02.zip

v4.01 – 10-25-2016 – Set-CsFeatures.v4.01.zip

v4.0 – 10-24-2016 – Set-CsFeatures.v4.0.zip


See the changelog for information on what’s changed/included in each version.

  1. Martijn
    October 25th, 2016 at 06:24 | #1

    Thanks for the script… again it is a big time saver!!

    Got a .NET Assemblies error.
    Solution that worked for me: “Add-Type -AssemblyName System.Web”

    Windows Server 2012 R2 with latest updates.
    Unable to find type [System.Web.HttpUtility]. Make sure that the assembly that contains this type is loaded.
    At C:\INSTALL\Set-CsFeatures.ps1:1376 char:5
    + [string] $DestFile = [System.Web.HttpUtility]::UrlDecode(($SourceFile | Spli …
    + ration: (System.Web.HttpUtility:TypeName) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound

    • October 25th, 2016 at 07:58 | #2

      Did you just add that line, or did you replace something? Where did you add it?

  2. Martijn
    October 26th, 2016 at 09:02 | #3

    I just run that cmdlt before running the script… 🙂

  3. Davide Altea
    October 26th, 2016 at 09:54 | #4

    Hi Pat,

    many many thanks for the script !!! Awesome work as usual !!!

    Is there a chance to ìnsert SQL part of setup (RTCLOCAL and LYNCLOCAL istances) in the S4B script too as for Lync 2013 ?

    Best regards,


    P.S. I have bought your masterpiece “Skype for Business Unleashed” 🙂

    • October 26th, 2016 at 18:22 | #5

      That is in the plans. The reason why it wasn’t put in there initially is because SQL Express 2014 was still at RTM. Plus, the installer method is different than the 2013 method. So I need to figure that out. I should be able to tackle some of that really soon.

      Thanks for buying the book!

  4. Linus Cansby
    October 27th, 2016 at 03:18 | #6


    Perfect, “Add-Type -AssemblyName System.Web” helped me with the same error.

    • October 27th, 2016 at 09:01 | #7

      I was able to duplicate the problem, and the fix. It’s checked in for the code for 4.02. Should see the new build no later than early next week.

  5. Davide Altea
    November 8th, 2016 at 10:15 | #8

    Hi Pat,

    can you include in the script installation of Windows8.1-KB2982006-x64 ?

    It’s a prerequisites for 2012 R2 🙂

    November 14th, 2016 at 06:47 | #10


    nice script, but got an error downloading the en_office_online_server_may_2016_x64_dvd_8484396.iso, got hold of the ISO file, but got this error when installing “Office Online Server not installed. Unable to attempt installation of Language Pack”

    any solution for this ?

    November 15th, 2016 at 02:38 | #12

    Pat Richard :
    Please follow the directions from the FAQ to send me the log file.

    E-mail sent

  8. Brad Owen
    May 10th, 2017 at 17:38 | #13


    I seem to be hitting a blocker in your Test-IsRebootRequired function. You are querying for test-path for Component Based Servicing\RebootPending but in 2012 R2 that exists. I believe this is what you are looking for

    Get-ChildItem “HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending” -EA Ignore


    • May 10th, 2017 at 17:39 | #14

      Are you getting an error? There are multiple places where reboot flags can appear.

    • May 10th, 2017 at 17:50 | #15

      I just looked on a bunch of 2012R2 servers, and the ‘RebootPending’ key does NOT exist.

  9. Brad Owen
    May 12th, 2017 at 11:40 | #16

    I rebooted multiple times, it never cleared. I then tested a number of reboot scripts and all said no reboot required. All the scripts I found used the Get-Childitem versus the path and the key still existed but no values underneath. After I modified your script to the above value of Get-ChildItem, I was then able to proceed. So maybe mine was a one-off case.

  10. May 12th, 2017 at 12:02 | #17

    @Brad Owen
    Got to be some issue on your end. I checked a 1/2 dozen different servers in different environments, and none had that key. I had two servers in two different environments that had pending Windows Updates. Neither had the key initially (as expected). I installed the updates, and before rebooting, checked again, and both DID have the key (as expected). I rebooted, and checked again, and neither had the key any longer (as expected).

    I then built a new 2012 R2 server, and it did NOT have the key.

    This script has been used to build literally THOUSANDS of servers all over the world. I’m confident in the reboot detection code.

  11. Korbyn
    May 18th, 2017 at 16:02 | #18

    Running into an issue with v10 on the Edge server. When its asking for the interface that will be used for internal traffic, all that’s displaying is “0. (Get-NetAdapter | Sort-Object name).name”
    I ran a v5 version that I had, seem to work there. Seems like the New-PickList function isn’t working well in that spot.

  12. Davide Altea
    May 26th, 2017 at 07:48 | #19

    Hi Pat,

    with CU5 Windows 2016 is now supported. Can you kindly update the script ?

    Thanks a lot !

  13. June 28th, 2017 at 21:04 | #20

    @Davide Altea
    Pretty sure Pat is already on it, he’s usually quite quick with these things. I’m sure we will see a beta get sent around soon. Pat added some 2016 stuff shortly after it went GA to detect and throw appropriate error messages.

    • June 28th, 2017 at 21:06 | #21

      Yep – two issues slowing me down. 1 is a project at work, and 2 is a lack of a 2016 server in my lab. Working on resolving both issues.

  14. Korbyn
    July 5th, 2017 at 20:21 | #22

    Made some progress, line 2582, removed the single quotes from $InternalNic = New-PickList -Data ‘(Get-NetAdapter | Sort-Object name).name’ so now I actually get the NIC list.

  15. July 5th, 2017 at 22:08 | #23

    It should probably be
    $(Get-NetAdapter | Sort-Object -Property Name).Name
    note the leading $

  16. Korbyn
    July 6th, 2017 at 20:08 | #24

    @Pat Richard
    It helps, but the internal/external NIC config on the Edge installation is still not working. Internal sort of works, it won’t clear the Default Gateway if it’s there, and External nic section fails utterly.

  1. October 24th, 2016 at 12:41 | #1
  2. November 6th, 2016 at 20:35 | #2
  3. November 13th, 2016 at 16:40 | #3
  4. May 23rd, 2017 at 16:19 | #4
  5. September 3rd, 2017 at 18:21 | #5