(Re)configuring IM Integration

Last Update: August 16th, 2016.

powershellNote: The procedure has changed for Exchange 2016, which can use overrides to make this setting persistent. For these instructions, consult this article.

Anyone who has configured Exchange 2013 IM integration with Lync Server at some point has to modify the web.config file on the Mailbox servers to configure OWA with the proper certificate for enabling IM. Another thing (read: nuisance) is that when you have configured IM integration and you apply a Cumulative Update to Exchange 2013, the web.config will be overwritten, in which case you need to reapply those changes to the web.config file.

This is where the script Configure-IMIntegration.ps1 might come in handy.

Using the script requires Exchange 2013 and Lync Server. You need to provide the Lync pool and the Mailbox server you want to configure needs to have a valid certificate assigned to IIS (or UM) service. The script will modify the web.config remotely using the system share (e.g. C$), using the location of the Exchange installation, and uses WMI to recycle the OWA Application Pool in IIS. It will create a backup of the web.config before modifying it.

Note that the script does not perform the following steps:

  • It does not perform the Lync Server parts to configure IM integration, e.g. configure Exchange as a trusted application.
  • It does not configure Lync Server as an partner application for Exchange (Configure-EnterprisePartnerApplication.ps1).

The script Configure-IMIntegration.ps1 uses the following syntax:

.\Configure-IMIntegration.ps1 [-Server <String>[]] -PoolFQDN <String> [-AllCAS] [-AllMailbox] [-UM] [-Thumbprint <String>]

A quick walk-through on the parameters and switches:

  • Server specifies the server(s) to configure. When omitted, it will configure the local server. This parameter is mutually exclusive with AllMailbox.
  • AllMailbox switch specifies to configure all Mailbox servers. This switch is mutually exclusive with Server.
  • AllCAS switch specifies to enable IM integration on all Client Access servers.
  • PoolFQDN specifies the FQDN of the Lync Pool to use. This parameter is required.
  • UM specifies that the script should look for a certificate assigned to UM services instead of IIS (default).
  • Thumbprint to manually specify the thumbprint of the certificate to use.

So, suppose you want to quickly reconfigure IM integration on a Mailbox server after applying a Cumulative Update, you can use:

.\Configure-IMIntegration.ps1 -PoolFQDN lync.contoso.com –Server exchange01.contoso.com


Or, you can quickly configure Mailbox servers and CAS servers for IM integration after performing the required steps to configure the trusted application settings and installing and assigning the certificate for UM:

.\ Configure-IMIntegration.ps1 -PoolFQDN lync.contoso.com -AllMailbox –AllCAS


Also, in the example above, the CAS servers had already been enabled for IM.

You can download the script from the TechNet Gallery here.

Feedback is welcomed through the comments. If you got scripting suggestions or questions, do not hesitate using the contact form.

Revision History
See TechNet Gallery page.

10 thoughts on “(Re)configuring IM Integration

  1. Excellent script that helps to automate the process nicely. I still don’t understand why MSFT can’t remove the dependency on the web config file. And also retain previous settings when installing a new CU. The additional admin overhead is a real inconvenience.


  2. Hi Michel,

    Looks like a great script – I am currently upgrading to CU7 and was planning to make use of this script but I am having an issue running it:

    You cannot call a method on a null-valued expression.
    At C:\Scripts\Configure-IMIntegration.ps1:129 char:13

    After a quick look, $version on line 127 is not being populated. From EMC, when I run ‘(Get-ExchangeServer -Identity mbx6).AdminDisplayVersion’, it returns ‘Version 15.0 (Build 1044.25)’ as a system.string.

    If I run ‘(Get-ExchangeServer -Identity mbx6).AdminDisplayVersion.Major’, no results are returned.

    Any ideas?


      • Hello Michel –

        Should line #127 be using $Identity instead of $Server for Get-ExchangeServer?

        $Version= (Get-ExchangeServer -Identity $Identity).AdminDisplayVersion.Major

        This would only be an issue if running against multiple servers (i.e. using the -AllMailbox switch) and I suppose would also be masked if running the script directly on an Exchange 2013 server.


      • I’m running the script from EMS on one of the exchange 2013 servers, to configure other exchange servers. For example I am running EMS locally on MBX1 and trying to use the script to configure MBX2.


  3. Pingback: Интеграция OWA и Lync | ILYA Sazonov: ITPro

  4. Pingback: IT/DEV Connections 2015 Wrap-Up | EighTwOne (821)

  5. Pingback: Exchange 2016 and IM Integration | EighTwOne (821)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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