New-LyncMeetingWarmup

Complaints regarding a slow meeting join process in Lync aren’t at all uncommon, and in many cases are actually as a result of IIS’s automatic recycling process, itself intended to improve reliability of the IIS websites.

Drago Totev has published a fantastic process by which you can ensure your Lync IIS application pools are always sitting there idling away, ready for a user to join.

In his post, Drago walks you through how to create a scheduled task on your FE’s that waits for the Event that’s logged each time IIS recycles the Application Pools. When that trigger is seen, the scheduler fires a script that sends a dummy meeting join request through to IIS which then “warms them up” ready for a real user to join.

I recently followed his setup to add the Schedule to four Front-Ends, and decided by #2 that it would be great if you could just run a PowerShell script to do it all for you automatically. And now you can.

I’ve opted for one script to do everything, and in this case it serves dual purposes: it’s both the script you run to create the Scheduled Events, and it’s also the same script that the Scheduler fires to warm up the app pools. For bonus points it’s signed as well (thank you DigiCert), which will hopefully appeal to those who don’t like running unsigned scripts.

It’s pretty simple to use.

Creating the Scheduled Tasks

First off, realise that the script needs to be run from the folder you’re going to leave it in. The script captures its path in the process of creating the Scheduled task, and the Action it runs is going to look for it in that location – so make sure you don’t go moving or deleting it after you run the “create” step!

.\New-LyncMeetingWarmup.ps1 -CreateTasks -Verbose

New-LyncMeetingWarmup-Create

Done.

The two Schedules look like this, with only minor differences in the Triggers and Actions to discern between a recycle of the Internal or External site:

New-LyncMeetingWarmup-Task

Query the Tasks

You can also run a query to see if or when the tasks have run:

.\New-LyncMeetingWarmup.ps1 –GetScheduledTaskInfo

(The –verbose switch doesn’t reveal any extra info at this stage)

New-LyncMeetingWarmup-QueryTaskInfo

Here’s the triggering event in the Event Viewer:

New-LyncMeetingWarmup-Event5074-edit

——-

Server 2008

The PowerShell commandlets required to create or query the scheduled tasks aren’t present in Server 2008 or 2008 R2, so (as of v1.2) the script detects this and displays a message.

The work-around is for you to follow a slightly varied version of Drago’s manual process:

Skip the script creation in Step 1 – just plonk this script somewhere on the Front-End server and note its location.

Follow Step 2 to create the two Tasks, and enter the applicable line below as the “Add arguments” text for the relevant task:

-Executionpolicy AllSigned -NoProfile -file "<ThePathToTheScript>New-LyncMeetingWarmup.ps1" -internal
-Executionpolicy AllSigned -NoProfile -file "<ThePathToTheScript>New-LyncMeetingWarmup.ps1" -external

EditTaskAction

——-

Revision History

6th June 2020: Updated the Download link to point to GitHub.

v1.5: 12th November 2019

  • Added test for Server 2019.
  • Added my auto-update code.

v1.4: 3rd March 2018

  • Thank you @TrevorAMiller for pointing out MS changed the versioning in Server 2016 between Preview and GA. Updated test.

v1.3: 10 February 2015

  • Whoops: fixed a tiny typo in the updated version test that broke it for Win 8.1 & Server 2012 R2

v1.2: 7 February 2015

  • My colleague Tristan highlighted that the script fails to generate the tasks if your o/s is Server 2008. I’ve amended it to work as best it can with 2008. It can’t create the tasks – that step you’ll still need to do manually, however the tasks you create can still just call this script and it will "warm up" your pools for you. I’ve added more how-to guidance on the blog post.
  • Neatened the CmdletBinding. Makes for a more accurate "get-help" output & blocks unsupported "-WhatIf" and "-Confirm".
  • Tweaked the .EXAMPLES.

v1.1: 17 January 2015:

  • Realised v1.0 wouldn’t work correctly for EE pools, and that the "meetFqdn" isn’t actually required.
  • Changed the ScheduledTask Arguments to an execution policy of "AllSigned". (Was unrestricted, leftover from design)
  • Changed write-host to write-output & added "-NoProfile" to $TaskArg (thanks Pat)

v1.0 : 16th January 2015: This is the original release

Download

You’ll find a code-signed version of the script on GitHub. You’re welcome to pinch, adapt or improve upon the code with my blessing. If you encounter any problems with it please create an issue on the repo.

Credits

Drago Totev for the original solution: http://www.lynclog.com/2013/12/user-might-experince-delay-when-join.html

Creating a task in PowerShell: http://www.verboon.info/2013/12/powershell-creating-scheduled-tasks-with-powershell-version-3/

Tricky Task creation: http://stackoverflow.com/questions/20108886/scheduled-task-with-daily-trigger-and-repetition-interval

https://p0w3rsh3ll.wordpress.com/2013/07/05/deprecated-features-of-the-task-scheduler/

 

– Greig.

5 Comments

  1. Thanks Tristan, that’s a weird one. I though the criteria was the version of PowerShell, but that seems not to be the case: I have a Server 2008 R2 and a Server 2012 R2 that are both reporting the same version, yet (as you’ve found) the 2008 one crashes when you run the script:

    PS > $PSVersionTable.PSVersion

    Major Minor Build Revision
    —– —– —– ——–
    3 0 -1 -1

    I’ll probably update the script on the weekend to add this next test:
    PS >if (get-command new-scheduledtaskaction -ea silentlycontinue) {write-host “Yes”} else { write-host “nope”}
    nope
    PS >

    Thanks for bringing it to my attention!

Leave a Reply

Your email address will not be published.

... and please just confirm for me that you're not a bot first: Time limit is exhausted. Please reload the CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.