Run multiple instances of Skype for Business concurrently

Published: Tuesday, December 19 2017

How to run multiple instances of Skype for Business concurrently

Microsoft's Skype for Business (formerly named Lync and Communicator before that) is a great collaboration tool but unfortunately it doesn't support using multiple accounts (concurrently).

Launching a 2nd instance just activates the already running instance, and brings the main Window to the foreground. The behaviour is very similar to Google Earth on Citrix XenApp which I covered in a previous blog.

This is very inconvenient if you have more than one account, e.g. if you're an external consultant you likely have an account within your own organization and one in the customer's organization.

In my case, I have a work (Cloudhouse) account and an account for the Dutch Citrix User Group (DuCUG), as I am a member of the steering group.

I don't believe Microsoft is deliberately blocking running multiple instances, it just hasn't accounted for it.

The way developers detect if an application is already running is to use synchronization objects, typically this is a Mutex. To see which objects Skype for Business is using we can use API Monitor

API Monitor is a free software that lets you monitor and control API calls made by applications and services. Its a powerful tool for seeing how applications and services work or for tracking down problems that you have in your own applications.a

Once you've started API Monitor you can select which API calls you'd like to monitor. Since we are interested in sychronization objectes I have selected Event and Mutex from System Services -> Synchronization:

API Monitor | API Filter | System Services | Synchronization | Event | Mutex

Now we can launch Skype for Business via File | Monitor new Process

API Monitor | File | Monitor New Process | C:\Program Files (x86)\Microsoft Office\root\Office16\lync.exe

Press OK to launch Skype for Business and after the logon is complete we have a list of the required synchronization objects:

Next step is to create a container by capturing the Skype for Business installation with our Auto Packager and add the following lines to the MutexIsolation section of the Redirections.xml file:

<MutexIsolation>
   <MutexName>Local\MicrosoftOfficeCommunicatorSharedMemoryAccess</MutexName>
   <MutexName>Global\Office Communicator_</MutexName>
   <MutexName>Communicator-</MutexName>
</MutexIsolation>

Since I already have Skype for Business installed on my machine, I am going to leverage a lesser known feature of our redirection engine (AAV) which is to run a natively installed application and apply redirections to it.

This means that I can run Skype for Business with and without AAV (our redirection engine) concurrently, without installing it twice and without even creating a container!

To make sure we can use different settings (e.g. accounts) between the different Skype for Business instances we need to virtualize the folders and registry keys where Skype for Business writes it's settings.

Fortunately a Process Monitor trace and a quick look at the filesystem revealed that all required was 2 folders and 2 registry keys.

For the filesystem add this to the Redirections.xml:

<FileSystem>
   <FolderMatch>
      <From>%AppData%\Microsoft\Office\16.0\Lync</From>
      <To>%AppData%\Microsoft\Office\16.0\Lync2</To>
   </FolderMatch>
   <FolderMatch>
      <From>%LocalAppData%\Microsoft\Office\16.0\Lync</From>
      <To>%LocalAppData%\Microsoft\Office\16.0\Lync2</To>
   </FolderMatch>
</FileSystem>

This will redirect the Lync folder to Lync2 in both Local- and Roaming Application Data.

Next add these registry redirections to Redirections.xml:

<Registry>
   <VirtualRoot>HKCU\Software\Cloudhouse\AppAccelerator\SkypeForBusiness</VirtualRoot>
   <Redirects>
      <KeyMatch>
         <From>HKCU\Software\Microsoft\Office\16.0\Lync</From>
      </KeyMatch>
      <KeyMatch>
         <From>HKCU\Software\Microsoft\Office\16.0\Common\Identity</From>
      </KeyMatch>
   </Redirects>
</Registry>

Finally add the Skype for Business executable (lync.exe) to Programs.xml:

<Program>
   <RunCondition>run1</RunCondition>
   <ProcessWindowStyle>Normal</ProcessWindowStyle>
   <Path>%DefaultDir%\AppAcceleratorV.exe</Path>
   <Args>/f "C:\Program Files (x86)\Microsoft Office\root\Office16\lync.exe" %FILEARGS%</Args>
   <WorkingDirectory />
   <WaitCondition TimeoutInSeconds="0">None</WaitCondition>
</Program>

Now let's see this in action:

 

By Remko Weijnen, EUC Specialist

Tags: CitrixMicrosoftStore for BusinessUWP

Comments






Allowed tags: <b><i><br>Add a new comment:


Tags for this Article:

Citrix Microsoft Store for Business UWP

Blog Links

Reflecting on 2017

Our CTO, Founder and new CEO, Mat Clothier reflects on some of the changes the company has made this year, and how they helped make 2017 such a great year.

Enabling Auto Update for Desktop Apps Converted to UWP

Win32 and .NET applications can be converted to Universal Windows Platform (UWP) apps but how do you keep them up to date when you publish them to the Store for Business, or deploy with solutions like Citrix XenMobile or Microsoft InTune? This blog provides an example of how this can be done with Cloudhouse Compatibility Containers, enabling you to keep your apps update for your users. By Remko Weijnen, EUC Specialist