Wednesday 24 September 2014

Configuring On Premise Lync and Exchange Online for hybrid voice mail

Fellow MVP Elan Shudnow wrote a great Exchange Unified Messaging provisioning script back in 2010 to bulk enable users for Exchange Unified Messaging.


This is great for running in Office365 as the EAC is a real pain for doing anything semi-autonomous, especially if a large amount of users are involved.

So this is one side of the puzzle solved for Exchange and Lync integration for voice mail integration.

We still need to enable all or at least a proportion of users for a hosted voice mail policy when the users' mailbox is in Exchange Online and Lync is on-premises or hosted.

I am assuming you have your hosted voice mail policy and hosting provider configuration created and this is working to exap.um.outlook.com just fine and dandy.


What the script does is three fold:
  
1. It will apply the hosted voice mail policy to your selected users 
2. It will set their 'hostedvoicemail' attribute to $true 
3. It will set their UPN as their email address if it isn't already as Lync uses this to find the EWS endpoint for the users mailbox

Here's the script:

#Oliver Moazzezi Exchange2010.com
#Enter OU DN for $OU
#An example of an OU DN is: "OU=oliver,OU=moazzezi,OU=exchange,DC=2010,DC=com" - keep it in quotes
#You can see a list of all Hosted Voice Mail policies by running Get-CsHostedVoiceMailPolicy
#Ensure you keep the "Tag:"

#Variables
$OU = "OU DN"
$Policy = "Tag: Policy"

#Import (not necessary in Windows Server 2012+ but won't cause any issues)
Import-Module Lync

#Apply hosted voicemail configuration to tenant
Write-Host The total number of users for this OU are: (Get-CsUser -OU $OU).count
Write-Host Applying Hosted Voice Mail Policy: $Policy to all discovered users for the tenant -foreground yellow
Get-CsUser -OU $OU |Grant-CsHostedVoiceMailPolicy -PolicyName $Policy
Write-Host Applying Hosted Voice Mail attribute to TRUE on all discovered users for the tenant -foreground yellow
Get-CsUser -OU $OU |Set-CsUser -HostedVoiceMail $true

#Set email address on all users for Lync to find Exchange EWS via autodiscover
Get-AdUser -filter * -searchbase $OU | %{$upn = $_.UserPrincipalName; Set-ADUser $_ -replace @{'mail' = $upn}}

#Configuration complete
Write-Host Configuration completed -foreground yellow


I can write up the process of creating the hosted voice mail policy, the hosting provider and clarification on what is needed on the Edge Servers SAN certiifcate if people believe there is value in this. Let me know in the comments.

Take care,

Oliver Moazzezi - MVP Exchange Server






No comments: