Home > Lync Server > Script: Set-Cs2013Features.ps1 – Easily Install Prerequisites and Tools for Microsoft Lync Server 2013

Script: Set-Cs2013Features.ps1 – Easily Install Prerequisites and Tools for Microsoft Lync Server 2013

WARNING!

 

An issue has been identified in Windows Server 2012 servers that are built as Server Core, but converted later to Server with Gui. Installation of Windows Features, either manually or via a script, fail if Windows Updates are installed BEFOREHAND. That being the case, the script below cannot be used in such scenarios. I’m working on detecting (if possible) servers that are converted, as well as researching why they fail. Thanks to John for pointing it out. It’s likely that the issue detailed here is the cause.

Lync 2013 logo 128x128Description

This script will assist in getting servers ready for the installation of Microsoft Lync Server 2013 on Windows Server 2012 and Windows Server 2012 R2. This includes the operating system prerequisites, SQL Express (where necessary), Silverlight, and more. Some post installation options are also available, and include Microsoft tools such as the debugging tools, the Best Practices Analyzer (BPA), Connectivity Analyzer, and more. Where the script needs files available online, it will automatically download them. More options will be added as I have time, and can properly test. This includes Edge, Director, and Mediation server prerequisites, and more tools. If you have suggestions, please feel free to comment below.

The current options are:

1. Director – Installs the OS prerequisites and SQL Express instances required to install this role.

2. Edge – Installs the OS prerequisites and SQL Express instances required for this role.

3. Front End – includes the Operating System prerequisites, Microsoft Silverlight, as well as the installation of SQL Express SP1 and creation of the various required instances. The SQL Express installs are done because Lync Server installs the RTM version by default. So installing the SP1 version saves a long update later. Note that each instance takes 3-5 minutes to install – longer on slower machines. Enterprise edition servers have two instances, RTCLocal and LyncLocal, and Standard edition servers also have the RTC instance. See the syntax and example sections below on how to call the script for the two types of servers. This option will also prompt if you’d like the required firewall exceptions created for my Get-CsConnections.ps1 script. This option will also prompt if the Lync Room System Admin Portal will be installed. If you select Yes, the ASP.NET MVC 4 for Visual Studio 2010 SP1 and Visual Web Developer 2010 SP1 prerequisite for that is installed.

4. Mediation – still being tested to make sure I didn’t miss something.

5. Office Web App – Installs the OS prerequisites required, then installs the Office Web App binaries, and then installs several recent updates. Almost everything needed to deploy an Office Web Apps server.

6. Persistent Chat - Installs the OS prerequisites and SQL instance required for this role.

7. Lync Server 2013 Resource Kit - tools that make troubleshooting and administrating a Lync environment easier, such as Address Book config, etc.

8. Lync Server 2013 Persistent Chat Resource Kit – tools useful for Persistent Chat environments.

9. Lync Server 2013 Debugging Tools - includes the logging tools such as OCSLogger and Snooper. Helpful for troubleshooting.

10. Lync Server 2013 Stress and Performance Tool – prepare, define, and validate performance

11. Lync Server 2013 Best Practices Analyzer – this tool helps identify any issues from a best practices perspective

12. Lync Server Connectivity Analyzer – identifies any issues that may result in connectivity problems for mobility clients including the Lync Windows Store app

13. Install/Update Lync Server 2013 Documentation Help

14. Create scheduled task to automatically update PowerShell help files daily. I discuss this in Function: New-PSUpdateHelpScheduledTask – Auto Update PowerShell Help

15. Launch Windows Update

16. Create Shutdown, Logoff, and Restart tiles on desktop – this is a streamlined version of Create a Shutdown/Restart/Logoff Windows 8 Tile for the Start menu (PowerShell) that puts easy to reach Shutdown, Restart, and Logoff tiles on the Start screen. In version 1.1, this was changed from the Start page of the logged on user who runs the script to the desktop and start page of all users.

17. Custom PortQryUI

18. Install Microsoft Message Analyzer

19. Add custom Scheduler simple URL – if you’d like to have a simple URL for the scheduler app, such as scheduler.contoso.com, this option will handle the configuration of that. Note that this option requires that the simple URL provided be in the Subject Alternative Names (SAN) list of the certificate on your Front End servers. See Understanding the Lync Web Scheduler for additional info.

20. Install SQL Server 2012 Management Studio

21 Install telnet client

22. Download latest Lync Server 2013 Cumulative Update – this ONLY downloads the file. It does not install it.

23. Create Windows Update tile on desktop

24. Microsoft Unified Communications Managed API 4.0, Runtime (UCMA 4.0) – this is required if you’re going to run sefautil.exe from the resource kit. It’s still recommended that sefautil.exe be used on a dedicated box.

25. Set recovery of Lync services to “restart”. See Set recovery of Lync services to “restart” for more info.

26. Lync Server 2013 Watcher Node [Download Only]

27. Lync Server 2013 Management Pack & Documentation [Download Only]

28. Configure Skype Federation. This removes the MSN Public Provider and adds the Skype Public Provider, complete with icon. Download includes the Lync-Skype Provisioning Guide. See http://blogs.technet.com/b/lync/archive/2013/05/23/lync-skype-connectivity-available-today.aspx for more info.

29. Lync 2013 Rollout and Adoption Success Kit (RASK) (DOWNLOAD ONLY)

30. Wireshark. This downloads the installer and starts it. Due to the fact that WinPCap can’t be silently installed, a silent install of Wireshark isn’t possible. You’ll just have to go through the install manually.

31. Enable Photo URL option. Enables the photo URL option in the client. See http://www.lynclog.com/2013/11/lync-2013-client-and-and-pictures-from.html for more info.

32. Fix Control Panel font. Reverts the font in the Control Panel back to the original Segoe UI. See Resetting the Font in Lync Server Control Panel – Goodbye Times New Roman!

Simply choose your desired option. When the script is finished, it will return to the menu.

Note: The installation of some Lync Server 2013 roles requires some .Net 3.5 components, which are not installed in Windows Server 2012 by default. So the script will need to know where your Server 2012 installation media is. The script defaults to the CD-ROM/DVD-ROM drive with the lowest drive letter (typically D: or E:), but can be configured for other locations.

The script will also create a log file that can be used for troubleshooting. The log file is created in a logs folder inside the $TargetFolder (by default, c:\_install)

Syntax

C:\Set-Cs2013Features.ps1 [[-TargetFolder] ] [[-Win2012Source] ] [[-SQLPath]] [-WhatIf] [-Confirm]

Examples

Set-Cs2013Features.ps1

This will launch the script with the default options for Enterprise edition servers

Set-Cs2013Features.ps1 -Win2012Source e:

This will launch the script using the e: drive for the source of the Windows Server 2012 installation files

Set-Cs2013Features.ps1 -sqlpath "d:\sqlexpress"

This will install any related SQL Express instances to the specified path

Installation

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.

Download

v2.3 – 02-08-2014 - Set-Cs2013Features.v2.3.zip

v2.2 – 01-20-2014 – Set-Cs2013Features.v2.2.zip

v2.1 – 12-17-2013 – Set-Cs2013Features.v2.1.zip

v2.0 – 11-26-2013 – Set-Cs2013Features.v2.0.zip

v1.9 – 10-28-2013 – Set-Cs2013Features.v1.9.zip

v1.8 – 08-01-2013 – Set-Cs2013Features.v1.8.zip

v1.7 – 05-31-2013 – Set-Cs2013Features.v1.7.zip

v1.6 – 05-24-2013 – Set-Cs2013Features.v1.6.z1p

v1.5 – 05-10-2013 – Set-Cs2013Features.v1.5.zip

v1.4 – 05-03-2013 – Set-CsLync2013Prerequisites.v1.4.zip

v1.3 – 04-29-2013 – Set-CsLync2013Prerequisites.v1.3.zip

v1.2 – 04-01-2013 – Set-CsLync2013Prerequisites.v1.2.zip

v1.1 – 02-28-2013 – Set-CsLync2013Prerequisites.v1.1.zip

v1.0 – 02-08-2013 – Set-CsLync2013Prerequisites.v1.0.zip

Changelog

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

  1. Ronald
    February 11, 2013 at 4:02 pm | #1

    Very nice! When will you filling the rest of the options (edge, directer, persistent chat, etc)?

    One note, I did notice that the message queueing components aren’t installed during frontend selection;

    Add-WindowsFeature MSMQ-Server, MSMQ-Directory

    Also maybe a good idea to let the script install .NET Framework 3.5 if it is not already installed in stead of requiring you to mount the Windows Server iso.

    • Pat Richard
      February 11, 2013 at 4:25 pm | #2

      Message queueing wasn’t listed in the official MS docs as being a requirement. At least not that I found.

      And the reason why the Windows 2012 source files are required is because those files aren’t installed in Windows by default. So the files have to be pulled from the original source.

      • Ronald
        February 11, 2013 at 4:41 pm | #3

        Very sorry. I checked and indeed it is not a req for the frontend role. I checked in my persistent chat script. Sorry about that.

        I don’t know how far you are with the other menu options for the remaining roles but if it could help I could send my scripts for you to review? Would love to see it all consolidated into one script like you have done with the Lync 2010 prerequisites script.

  2. Pat Richard
    February 11, 2013 at 4:43 pm | #4

    Sure – send them along. My email address is in the comment block of the script.

  3. Christophe
    February 12, 2013 at 9:41 am | #5

    very nice script, thanks for the share

  4. February 14, 2013 at 11:02 pm | #6

    Pat, what about having the option to specify a local source folder to obtain the files from rather than downloading them? This would be a time saving for people who install Lync often and would have the files downloaded anyway.

    • Pat Richard
      February 14, 2013 at 11:06 pm | #7

      Already there. The default target folder is c:\_install. If the file already exists in that folder, then it doesn’t try to download it again. TargetFolder can be specified when you call the script using the -TargetFolder option.

  5. Andy Thompson
    March 13, 2013 at 11:33 am | #8

    Pat- Great script, noticed that if running on an Edge and trying to install either the Debugging tools or the reskit, it fails on the Visual C++ runtime install. Do you think you could get this added to the script?

    • Pat Richard
      March 13, 2013 at 9:09 pm | #9

      Debugging tools already checks for that. I’m adding the check for resource kit. Both should work fine once Lync is installed.

  6. Caleb Baker
    April 5, 2013 at 2:50 pm | #10

    is there a way to specify the drive to install the SQL databases on? Or does it all have to install on the c:\ drive?

    • Pat Richard
      April 5, 2013 at 2:51 pm | #11

      Not aware of a requirement that it be on c:. You could edit the script to that it installs it elsewhere.

  7. April 30, 2013 at 4:32 am | #12

    Hi, great script! I have tested office web app installation, but i think the script is missing the windows features InkandHandwritingServices.

  8. Chris Elliott
    April 30, 2013 at 1:55 pm | #16

    Great script! Appreciate the hard work you put in to keep this up.

    I have expanded on it for my client’s environment to install SQL on the D: Drive and provide for the SQL Instance Directory location. Lastly, I built an option to install the SQL 2012 SP1 Express Management Studio Tools. Let me know if you would like to include some of the code in your version.

  9. May 6, 2013 at 6:37 am | #17

    Hi thanks for script. However I got errors below when I ran it for Lync Standard?
    “Select an option.. [1-99]?: 3
    Installing operating system prerequisites
    True
    True
    WARNING: You must restart this server to finish the installation process.
    Installing RTCLocal instance. This will take several minutes.
    True
    Folder: “c:\_Install” does not exist, creating…Done!
    File: SQLEXPR_x64_ENU.exe does not exist, downloading…Done!
    Failed!
    Installing LyncLocal instance. This will take several minutes.
    File already exists
    Failed!
    Installing RTC instance. This will take several minutes.
    Failed!
    Installing SQL Management Studio. This will take several minutes.
    True
    Folder: “c:\_Install” exists.
    File: SQLManagementStudio_x64_ENU.exe does not exist, downloading…Done!
    Executing Install
    Failed!
    Installing Microsoft Silverlight
    True
    Folder: “c:\_Install” exists.
    File: Silverlight_x64.exe does not exist, downloading…Done!
    File: Silverlight_x64.exe…………………………………[installed!]
    Finished”

    • Pat Richard
      May 6, 2013 at 8:13 am | #18

      If you reboot and try again, does it work? Looks like the OS prereqs required a reboot, which will cause the SQL instances to fail. The script should have stopped before trying the SQL instances and forced a reboot.

      Let me know.

      • May 7, 2013 at 2:17 pm | #19

        Just to add another log paste, my run warned me about requiring a reboot but carried on anyway. This was with the -Standard switch.

        Select an option.. [1-99]?: 3
        Installing operating system prerequisites
        True
        True
        WARNING: You must restart this server to finish the installation process.
        Installing RTCLocal instance. This will take several minutes.
        True
        Folder: “c:\_Install” does not exist, creating…Done!
        File: SQLEXPR_x64_ENU.exe does not exist, downloading…Done!
        Failed!
        Installing LyncLocal instance. This will take several minutes.
        File already exists
        Failed!
        Installing RTC instance. This will take several minutes.
        Failed!
        Installing SQL Management Studio. This will take several minutes.
        True
        Folder: “c:\_Install” exists.
        File: SQLManagementStudio_x64_ENU.exe does not exist, downloading…Done!
        Executing Install
        Failed!
        Installing Microsoft Silverlight
        True
        Folder: “c:\_Install” exists.
        File: Silverlight_x64.exe does not exist, downloading…Done!
        File: Silverlight_x64.exe…………………………………[installed!]

        Finished
        And depending on how complete you want the script to be, you may want to do a free space check on the disk. I ran out of space on the lab server I am running this on. I’d say checking for 20GB would be good as I had ~10GB available before I started.

        • Pat Richard
          May 7, 2013 at 2:29 pm | #20

          Thanks. I think I’ve got that resolved in an upcoming release (probably Friday). I appreciate the comments!

  10. May 7, 2013 at 6:33 am | #21

    Did the reboot and the script ran successfully thanks. Just one issue when I try to publish the TOP for standard server I get “creating central management store – Failure”

  11. May 12, 2013 at 11:13 am | #22

    Thanks for updated script. The -standard switch no longer works? How are the standard options install selected?

    • Pat Richard
      May 12, 2013 at 11:16 am | #23

      Correct. As mentioned in the changelog, just select the FE option. Once the two SQL instances are installed, you’ll get prompted as to whether it’s a standard server. If it is, it will install the remaining required instance.

  12. May 12, 2013 at 11:16 am | #24

    Ah just got to the prompt asking if it was standard server… very cool!

  13. June 4, 2013 at 6:05 pm | #25

    ehloworld.com blog from Pat is a treasure chest and this particular script is the crown jewel made by a true Jedi master. Thank You !

  14. June 5, 2013 at 4:45 pm | #26

    Pat –
    VERY nice work.
    John

  15. June 12, 2013 at 3:37 am | #27

    Hi Pat, really great script! I also installed Office Webapps with it but I’m wondering which key it uses. Is there a way to change the product key afterwards?

    • Pat Richard
      June 15, 2013 at 10:52 am | #28

      It does not enter any key. Nor is one needed, I believe.

  16. Corey McClain
    • Pat Richard
      July 5, 2013 at 5:14 pm | #30

      Not sure I’m going to be able to get to that anytime soon. I don’t have a lab environment to test that.

      • Corey McClain
        July 17, 2013 at 9:12 am | #31

        #19 Has a spelling error: The term ‘Set-ModuleStatue’ is not recognized as the name of a cmdlet

        • Pat Richard
          July 17, 2013 at 9:18 am | #32

          Thanks Corey. I’ve updated my copy and will get a new version out soon.

  17. Jeffcsp
    July 30, 2013 at 9:27 am | #33

    Testing the latest 1.7, the sql express path cannot contain any spaces. Fails the validation line 35.

    • Pat Richard
      July 31, 2013 at 9:37 am | #34

      Looks like I have this resolved in v1.8, which should be out in the next day or so.

  18. September 13, 2013 at 11:49 am | #35

    Hi Pat,
    I get this error when installing OWAS. Suppose it just means it does not detect a proxy?
    “Get-ItemProperty : Property ProxyEnable does not exist at path HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVers
    ion\Internet Settings.
    At C:\temp\Set-Cs2013Features.ps1:1028 char:7
    + if ((Get-ItemProperty “HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (ProxyEnable:String) [Get-ItemProperty], PSArgumentException
    + FullyQualifiedErrorId : System.Management.Automation.PSArgumentException,Microsoft.PowerShell.Commands.GetItemPr
    opertyCommand”

    • Pat Richard
      September 13, 2013 at 12:06 pm | #36

      Yeah, that’s something I’m seeing as well on new machines that have never had a proxy. Go to line 1028, which looks like this:

      if ((Get-ItemProperty “HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings” -name ProxyEnable).ProxyEnable){

      and replace it with this:

      if ((Get-ItemProperty “HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings” -name ProxyEnable -ea 0).ProxyEnable){

      and tell me if it goes away.

  19. Andrew Burt
    October 22, 2013 at 3:26 pm | #37

    Awesome work Pat. How hard would it be to tell the script that it can run on Windows 2012 R2? Playing in lab and would love to fire script up but running R2 VM’s. Would it be as simple as editing here?

    #region variables
    [bool]$IsSrv2012 = (Get-WMIObject -class Win32_OperatingSystem).Version -match “6.2.920″
    [bool]$IsSrv2008R2 = (Get-WMIObject -class Win32_OperatingSystem).Version -match “6.1.760″

    • Pat Richard
      October 22, 2013 at 3:36 pm | #38

      I actually have a version that does run in 2012 R2. I was waiting for some more info from the product group as to any changes I would need to make from a prereq standpoint.

      • Andrew Burt
        October 22, 2013 at 5:23 pm | #39

        Thanks Pat – have changed the entry for the version match to use 6.3.9600 and the script seems to work well. Have used the pre-requisite install for FrontEnd and just having a look at other options. Will keep an eye out for your next release. Thanks again for your amazing work.

        • Pat Richard
          October 22, 2013 at 5:28 pm | #40

          I would drop that last zero to include service packs versions.

          • Andrew Burt
            October 22, 2013 at 6:15 pm | #41

            True! Thanks again. Will let you know if I encounter any 2012 R2 oddities during my testing.

  20. Mike
    November 5, 2013 at 10:29 am | #42

    This script is wonderful. I have been struggling to get the prerequisites installed and this does al lthe work. Thank you

  21. Ronald
    November 12, 2013 at 9:19 am | #43

    Hi, I used the script on a new Lync 2013 deployment on the first enterprise frontend server with the command “Set-Cs2013Features.ps1 -Win2012Source e:” and even though it mentions installing SQL on step 3 I don’t actually see SQL express installed.

    What am I doing wrong? I didn’t specify the sql parameter because the sql express installation should natively install db’s on a separate drive if it exists. If run through the deployment wizard to install local store at least.

    • Pat Richard
      November 25, 2013 at 12:06 pm | #44

      It doesn’t necessarily install them on a separate drive. Did you check the registry to see if they are listed there? The script looks at HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL for a key with the name of the instance (RTCLocal, LyncLocal, and, if it’s a standard edition, RTC). If the deployment wizard installs the instances, it uses the 2012 RTM version of SQL Express, whereas the script uses the SP1 version. So it saves you an upgrade.

  22. Bryan
    November 25, 2013 at 11:58 am | #45

    Is attempting to get this working on Windows 2008 R2 going to be worth a go? Or are you using a large number of 2012 specific features?

    • Pat Richard
      November 25, 2013 at 12:03 pm | #46

      It’s not going to happen. The script is written in PowerShell v3.0, which is native to Windows Server 2012 and above. Additionally, I don’t have the time to test in a 2008 R2 environment. 2008 R2 is already two versions back.

      • Bryan
        November 25, 2013 at 12:06 pm | #47

        I beg your pardon – I wasn’t suggesting *you* do it – I was going to have a crack. But I’ve not had a chance to really digest the content yet, so was going to ask for a feel from you on how hard that would be.
        All our Lync boxes here have PowerShell 3.0 installed already – so that hurdle at least is crossed.

        • Pat Richard
          November 25, 2013 at 12:09 pm | #48

          I don’t see it being worth it. I’ve had very little requests for it, as nearly everyone I talk to is installing on 2012 or 2012 R2. Converting it to support 2008 R2 could be painful, and since I’m constantly updating the script (a new version is due out soon), it would be out of date.

          • Bryan
            November 25, 2013 at 12:11 pm | #49

            Lucky them – I’m going to be stuck on 2008 R2 for the forseeable future. Oh well – thanks for your advice.

  23. December 3, 2013 at 1:54 pm | #50

    Hi Pat,
    Just a followup – if the host server for the Lync install EVER started as a core install, then moved to GUI (and this includes template server installs), your script is going to blow up on doing the Lync prereqs. The only way around this is to fix the host install (or get a clean full install to start with) – but your script will probably get blamed from the onset – when it is a host server issue with the inkandhandwritingservice and how the sxs local and on source get out of sync and refuse to play well with add-windowsfeature. Maybe you could add some logic checking to detect this condition?
    -John

  24. Pat Richard
    December 3, 2013 at 3:33 pm | #51

    Thanks, John. Per our Lync conversation, I’m researching to see if there is a way I can detect this scenario, and throw a flag.

  25. January 9, 2014 at 10:23 pm | #52

    Options 13(help) and 16(desktop tiles) in the script menu is opposite of blog description.

    • Pat Richard
      January 9, 2014 at 11:55 pm | #53

      Thanks. I’ve updated the article.

  26. Alessandro
    January 10, 2014 at 12:14 pm | #54

    HI,
    I discovered a Bug on the Web App case. the script is not taking the -Win2012Source option.
    to test I edited the ps file . after Case 5 (Switch 5) added the -Source …….

    correct line below.

    thank you for your script, great work!

    $RestartNeeded = (Add-WindowsFeature Web-Mgmt-Console, Web-Common-Http, Web-Default-Doc, Web-Static-Content, Web-Filtering, Web-Windows-Auth, Web-Net-Ext45, NET-WCF-HTTP-Activation45, Web-Asp-Net45, Web-ISAPI-Filter, Web-Includes, Web-Stat-Compression, Web-Dyn-Compression, InkAndHandwritingServices, NET-Framework-Core, NET-HTTP-Activation, NET-Non-HTTP-Activ, Web-ISAPI-Ext, NET-Framework-45-Core, NET-Framework-45-ASPNET -Source $Win2012Source\sources\sxs).RestartNeeded

    • Pat Richard
      January 10, 2014 at 12:21 pm | #55

      Yeah, that’s actually already fixed in v2.2, which should be out as soon as I add one more feature.

  1. February 8, 2013 at 10:35 am | #1
  2. February 12, 2013 at 12:28 pm | #2
  3. February 21, 2013 at 10:30 pm | #3
  4. March 11, 2013 at 9:23 pm | #4
  5. March 13, 2013 at 8:33 pm | #5
  6. March 19, 2013 at 12:30 pm | #6
  7. May 15, 2013 at 4:13 pm | #7
  8. May 27, 2013 at 10:37 am | #8
  9. July 14, 2013 at 8:30 pm | #9
  10. December 10, 2013 at 1:15 pm | #10
  11. March 6, 2014 at 4:17 pm | #11
  12. April 1, 2014 at 12:28 pm | #12

Leave a Reply