Chapter-17 – Practical PowerShell Office 365: Exchange Online

17 Unified Messaging

_____________________

In This Chapter

  • Overview
  • UM Basics
  • Basic Configuration
  • Skype Integration
  • User Management
  • Reporting

_____________________


Overview

Unified Messaging for Exchange Online allows the end user to get a fuller experience out of Exchange. Not only can they get emails to their Inbox, but now they can work with faxes and receive voicemail to their mailbox as well. The integration of UM allows for the end user to play voicemails from OWA, Outlook and their phone. Enabling them to be more productive and not concerned which client they are on. Adding Skype and UM completes the circle of Unified Communications with voice, email and fax on one platform.

As with all parts of Exchange, there are many PowerShell cmdlets that we can use to configure, modify, report and troubleshoot the UM infrastructure. Using these cmdlets we will walk through the various parts of the UM service for Exchange as well as providing insight into the configuration and managing PowerShell without a GUI.

Exchange Online's integration with Skype is also an important aspect of Unified Messaging. Skype provides many additional features that enhances the end user experience. From presence to voicemail, end users will get more than email in their Outlook client. Integration goes a bit deeper in the enhancements that are also brought to the OWA web client with presence also available as well as the ability to schedule.

As with any other portion of Exchange Online, we can also generate reports with PowerShell. We can report on server settings, end user access to UM and how Dial Plans and UM Policies are configured. PowerShell also comes with some built-in cmdlets for troubleshooting Unified Messaging issues. These cmdlets can be used in conjunction with other detection methods to narrow down issues within Exchange’s Unified Messaging.

UM Basics

In previous on-premises versions of Exchange, Unified Messaging was included as a separate role. With the advent of Exchange 2013 and 2016, the roles have been collapsed into a single server role. With Exchange Online we don't have to worry about the physical architecture behind the feature, but just the features of Unified Messaging.

Features of UM in Exchange Online:

Access to Exchange information

Play on Phone

Voicemail Form

User Configuration

Call Answering

Call Answering Rules

Voicemail Preview

Message Waiting Indicator

Missed Call and Voicemail Notifications Using SMS

Protected Voicemail

Outlook Voice Access (OVA)

Group addressing with OVA

Unified Messaging in Exchange consists of a few components. These components can be configured in the EAC or with PowerShell. Combined together, these components will allow Exchange to provide end users voicemail. The voicemail feature is accessible with Outlook, phone, and web. Here are the components that make up Unified Messaging:

UM Dial Plan – Establishes a link between a user’s extension and their mailbox in Exchange

UM Policy – Is a set of common parameters that are applied to a user mailbox

UM Service – Plays the users voicemail, greeting message and processes call answering rules

UM Call Router Service – Used to route calls to the Exchange server

Auto Attendant – Creates a menu system for users and callers to use

Outlook Voice Access – Gives users access to their voicemails using a phone call

Basic Configuration

In order to configure Unified Messaging in Exchange, we need to walk through the various components that makeup the Unified Messaging service in Exchange.

UM Dial Plan

First item that needs to be configured in order to enable Unified Messaging is a Dial Plan:

Get-Command *DialPlan

The first cmdlet we need to run is Get-UMDialPlan to check for any Dial Plans that may have been created. On a Greenfield tenant for Exchange Online:

With no plans pre-created, we’ll need to create a new Dial Plan. What options are there for configuring a new Dial Plan:

Get-Help New-UMDialPlan -Examples

For our sample configuration we’ll configure a few of Dial Plans. Each of these Dial Plans will correspond to a different country in an Organization. These regions all require different default languages to be available in Exchange. The countries involved will be United States, France and Japan. The Dial Plans need country codes as well as language definitions. How can we find the country code for these plans?

Search Terms: Country Codes

From that page we see that the country codes are as follows:

United States 1

France 33

Japan 81

After we have the country code we can also configure regionalized languages. In our case we have locations in non-English speaking countries and can change the language to what is used by the end user it will provide for a better end user experience. Exchange Server contains localized languages in something called Language Packs.

Search Terms: Exchange Server 2016 UM Language Packs

From that page we see there are a few languages that are supported by the Exchange UM:

In our sample scenario, we will need to create three Dial Plans for the three different physical locations. Some of the options we will also need are DefaultLanguage, Number of digits for the extension and URIType.

With these parameters and the previous language and country codes, we can create the Dial Plans for the different geographic locations:

New-UMDialPlan -Name "USDialPlan" -NumberOfDigitsInExtension 4 -URIType "SipName" -CountryOrRegionCode 1 –DefaultLanguage “en-US”

New-UMDialPlan -Name "FranceDialPlan" -NumberOfDigitsInExtension 4 -URIType "SipName" –CountryOrRegionCode 33 –DefaultLanguage “fr-FR”

New-UMDialPlan -Name "JapanDialPlan" -NumberOfDigitsInExtension 4 -URIType "SipName" -CountryOrRegionCode 81 –DefaultLanguage “ja-JP”

A successful creation of a UM Dial Plan should look like this:

Luckily, since we are working with Exchange Online, we do not have to worry about installing Language Packs or having dial plans fail because they are missing.

Once the plans are created, we can also modify these plans with a PowerShell cmdlet called ‘Set-UMDialPlan’. First, let’s review what is in the new UM Dial Plans we just created:

The base Get-UMDialPlan provides a good list of Dial Plans, but not a lot of useful information. If we run Get-UMDialPlan | FL we can see a lot more information and a lot of values we can customize:

Some items that can be configured to further customize the UM Dial Plans. A sample of these values are:

  • WelcomeGreetingFilename
  • InfoAnnouncementFilename
  • LogonFailuresBeforeDisconnect
  • UMAutoAttendants
  • DialByNameSecondary

    ** Note ** When a new UM Dial Plan is created, a new UM Mailbox Policy is also created:

    Get-UMMailboxPolicy | FT –Auto

Assigning UM Mailbox Policy

Now that we’ve defined our UM Dial Plans we need to assign them to users. In order to do so, we'll need to find the right PowerShell cmdlet.

PowerShell

What cmdlets are available for assigning UM Mailbox Policies to mailboxes in Exchange Online? Similar to the CASMailbox cmdlets, there is a similar set with ‘UMMailbox’ in the cmdlet.

Get-Command *UMMailbox

From the list above, it looks like the obvious choice is ‘Enable-UMMailbox’. Let’s review the cmdlet’s examples to see what we can do with the cmdlet:

Get-Help Enable-UMMailbox -Examples

Sample Scenario

A company just migrated to Exchange Online and added Skype for Business for their voice solution. The company wants to enable the UM feature of Exchange for all of their users. In this scenario, a large number of users are being enabled and thus a CSV file was created to contain the user data. The CSV file has the following fields:

SMTP,Extension,PIN

A sample of the data file would looks something like this:

To assign the correct plan to the user, we’ll look up the properties of the mailbox and use the 'UsageLocation' property as a determining factor as to what UM plan is assigned. Let’s create a script to accomplish this task.

Script

First, we need to import the UM configuration settings stored in a CSV in a variable called $CSV:

$CSV = Import-CSV ‘C:\Source\UMSettings.csv’

Variables

We need to define a variable for the admin email address:

# Global variables

$Admin = 'administrator@OnlineExchangeBook.onmicrosoft.com'

At this point we can use a Foreach loop to read each line of the CSV file to configure each user for UM:

Foreach ($Line in $CSV) {

Next, we’ll configure some variables we need within the loop:

# Local Variables

$Mailbox = $Line.SMTP

$Pin = [int32]$Line.Pin

$Extension = $Line.Extension

$Plan = $Null

Then we’ll need to figure out which 'UsageLocation' is configured for a mailbox since that is our criteria for assigning the UM Mailbox Policy:

$Location = (Get-Mailbox $Mailbox).UsageLocation

Next, we can compare the user’s OU versus the three sites and set the $Plan variable for the correct plan:

If ($Location -Eq 'France') {

$Plan = 'FranceDialPlan Default Policy'

}

If ($Location -Eq 'Japan') {

$Plan = 'JapanDialPlan Default Policy'

}

If ($Location -Eq 'United States') {

$Plan = 'USDialPlan Default Policy'

}

Finally, we can take all of the above and use it to configure the UM Mailbox using the Enable-UMMailbox cmdlet:

Enable-UMMailbox -Identity $Mailbox -UMMailboxPolicy $Plan -Extensions $Extension -PIN $Pin -NotifyEmail $Admin -SipResourceIdentifier $Mailbox -Whatif

Combining all of those lines we now have a complete script that will configure all of the mailboxes for UM with the data populated in a CSV file:

Complete Script

# Global variables

$CSV = Import-CSV ‘C:\reports\UMSettings.csv’

$Admin = 'administrator@OnlineExchangeBook.onmicrosoft.com'

Foreach ($Line in $CSV) {

# Local Variables

$Mailbox = $Line.SMTP

$Pin = [int32]$Line.Pin

$Extension = $Line.Extension

$Plan = $Null

$Location = (Get-Mailbox $Mailbox).UsageLocation

$Location

$Mailbox

If ($Location -Eq 'France') {

$Plan = 'FranceDialPlan Default Policy'

}

If ($Location -Eq 'Japan') {

$Plan = 'JapanDialPlan Default Policy'

}

If ($Location -Eq 'United States') {

$Plan = 'USDialPlan Default Policy'

}

Write-Host "The plan is $Plan"

Write-Host "The extention is $Extension"

Enable-UMMailbox -Identity $Mailbox -UMMailboxPolicy $Plan -Extensions $Extension -PIN $Pin -NotifyEmail $Admin -SipResourceIdentifier $Mailbox -Whatif

}

Secondary Dial Plans

An interesting feature available in Exchange UM is the concept of a secondary Dial Plan. These Dial Plans allow for a roaming user to use a different dial plan if they happen to be in a different location. If we were to continue to use our scenario above with the three different UM Dial Plans, we can configure a mailbox with a primary and a secondary UM Dial Plan.

** Note ** A user can be assigned more than one secondary extension.

In order to do so, we need an extension to assign the user and a Dial Plan to assign to the mailbox. We can use an extension of ‘3245’ since we configure the plans for four digit dialing before. This user travels between the US and France. That means that we will use the FranceDialPlan. While in the second location, the user will also need a second extension for dialing.

The caveat is that the plan cannot be configured with the Set-UMMailbox cmdlet and needs to be assigned with the Set-Mailbox cmdlet. We will use the SecondaryAddress and SecondaryDialPlan parameters to do so:

Set-Mailbox Damian.Scoles –SecondaryAddress 3245 –SecondaryDialPlan “FranceDialPlan”

Skype for Business Integration

In order for Exchange to work with Skype for voicemail, presence and other functionality, we need to configure Skype and Exchange as ‘partnering apps’. Microsoft provides good documentation for this integration at this link - https://support.microsoft.com/en-us/help/2614614/how-to-integrate-exchange-online-with-skype-for-business-online--lync. To find links and helpful documentation like this, use your favorite engine. I found this link like so:

Search Terms: Skype for Business Exchange Online integration

Which delivers these search results:

The link above brings us to the official Microsoft document for configuring Skype and Exchange for integration with each other:

https://technet.microsoft.com/en-us/library/jj688151.aspx

** Note ** Configuring Skype is out of scope of this book.

User Management

Once Unified Messaging is configured on the server, we now need to worry about the end user and any configuration / reconfiguration would need to be completed. On a day to day basis, UM configuration should be rather low and hopefully a set it and forget it setting. If there are any changes to made, Microsoft has provided a set of cmdlets to allow for this configuration. Let’s review these cmdlets:

PowerShell

Get-Command *UMMailbox

Modifying UM Mailbox

We can modify existing UM Mailboxes with the ‘Set-UMMailbox’. What parameters exist?

PhoneNumber

AirSyncNumbers

VerifyGlobalRoutingEntry

UMMailboxPolicy

IgnoreDefaultScope

DomainController

Identity

ProxyToMailbox

ProxyToServer

Verbose

Debug

ErrorAction

WarningAction

InformationAction

ErrorVariable

WarningVariable

InformationVariable

OutVariable

OutBuffer

PipelineVariable

WhatIf

Confirm

TUIAccessToCalendarEnabled

FaxEnabled

TUIAccessToEmailEnabled

SubscriberAccessEnabled

MissedCallNotificationEnabled

UMSMSNotificationOption

PinlessAccessToVoiceMailEnabled

AnonymousCallersCanLeaveMessages

AutomaticSpeechRecognitionEnabled

VoiceMailAnalysisEnabled

PlayOnPhoneEnabled

CallAnsweringRulesEnabled

AllowUMCallsFromNonUsers

OperatorNumber

PhoneProviderId

CallAnsweringAudioCodec

ImListMigrationCompleted

Name

For example, when a UM Mailbox is enabled, the users mail messages and calendar are available over the phone. If this service needs to be removed for all UM Mailboxes or particular mailboxes, the TUIAccessToCalendarEnabled and TUIAccessToEmailEnabled values will need to be configured as false like so:

Set-UMMailbox Damian -TUIAccessToEmailEnabled $False –TUIAccessToCalendarEnabled $False

We can also remove the PIN requirement for users accessing their voicemail using this one-liner:

Set-UMMailbox Damian –PinlessAccessToVoiceMailEnabled $True

Lastly, we can change the format of the voicemail from MP3 to a different format:

Set-UMMailbox Damian -CallAnsweringAudioCodec WMA

We can also further integrate Skype with Exchange by saving the Skype contact list in the Exchange mailbox:

Set-UMMailbox Damian -ImListMigrationCompleted $True

Removing UM Mailbox

Removing the UM Mailbox from a user can be done after they are terminated or possibly during a change of Unified Messaging Systems. To remove the UM Mailbox features from an Exchange mailbox, we can use ‘Disable-UMMailbox’. Let’s review examples for using the cmdlet:

Looks like we only need the SMPT address of the mailbox to disable:

Disable-UMMailbox –Identity Dave@WorldCorp.Com

Now this user has no UM Mailbox and cannot receive voicemails.

Reporting

Like any other IT system, having a way to report settings or configuration information in it is a necessary function. With Unified Messaging in Exchange, PowerShell can provide an insight into how things are configured. It can also be used for verification of data. For Unified Messaging, reporting could involve the configuration of user mailbox, UM Mailbox Policies, UM Service configurations and more.

Sample User Report

One task that IT could take on is validating phone lists against what is configured in Unified Messaging. A validating of data to confirm that users with UM mailboxes are configured with the right extensions, or even a secondary extension. An audit may also reveal mailboxes that should not have one, or have the wrong extension assigned.

The easiest way to reveal information on Unified Messaging is the ‘Get-UMMailbox’ cmdlet. The default results are OK, but we don’t need the Primary SMTP Address. Instead we’ll simplify the results like so:

Get-Mailbox | Get-UMMailbox | FT DisplayName,UMDialPlan,UMMailboxPolicy,Extensions

Another column that could be added would be the Phone Number field if the full phone number is populated and needs to be verified.

What if there are a lot of user moves and the IT department has noted a lot of users now have extensions for the wrong office, how would we go about validating the plans are correct? First, we would have to be sure that when a user moves, that either the user is put in the correct office site OU (if AD is configured that way) or maybe the user’s office attribute is set to their new office. For this script we can use a check like the script that was used to configure the UM Mailboxes earlier in the chapter.

In this case we’ll start with the usual variable definitions – locations and a variable to store all UM Mailboxes. Then we’ll use a Foreach loop to examine the assigned plan ($ConfiguredPlan) for the mailbox and compare it against the plan that should be assigned ($ExpectedPlan) according to the OU the user is present in. Then, once the comparison is made, report a good configuration in cyan and the wrong configuration with red text.

Complete Check Script

# Global Variables

$UMMailbox = Get-UMMailbox

Foreach ($line in $UMMailbox) {

$SMTP = ($line.PrimarySMTPAddress)

$Mailbox = Get-Mailbox $SMTP

$Org = $Mailbox.OrganizationalUnit

$ConfiguredPlan = $Line.UMDialPlan

$DisplayName = (Get-Mailbox $SMTP).DisplayName

If ($Location -Eq 'France') {

$ExpectedPlan = 'FranceDialPlan Default Policy'

}

If ($Location -Eq 'Japan') {

$ExpectedPlan = 'JapanDialPlan Default Policy'

}

If ($Location -Eq 'United States') {

$ExpectedPlan = 'USDialPlan Default Policy'

}

If ($ConfiguredPlan -eq $ExpectedPlan) {

Write-Host "User $DisplayName has the correct UM Dial Plan configured." -ForegroundColor Cyan

} Else {

Write-Host "User $DisplayName has the wrong UM Dial Plan configured." -ForegroundColor Red

}

}

If all of the plans are correctly assigned all of the results should show in cyan:

If things are not configured properly, we would expect to see some red from users with a Dial Plan that does not correspond to the office their account is in:

Thus, this script can be used as an audit mechanism for the Unified Messaging configuration for users.