Lync 2013 and Exchnage Online Hosted Voicemail setting resets after running DirSync

Got a colleague ringing me the other day with a strange issue:

He has Lync 2013 on premises with their voicemail hosted on Office 365 Exchange online, all configured and working wonderful.

However, for some users, the “HostedVoiceMail” attribute changes from “$true” to null. If he runs the “Set-csuser –identity Domain\Username –HostedVoiceMail $true” command again it will set it, but that will disappear as soon as DirSync runs again.

Did some investigation, and apparently – If it’s a shared mailbox, DirSync will switch it back from “$true” to “null”.

There is a workaround to fix this!

Go to your DirSync server, and at the following path: “%Program Files%\Microsoft Online Directory Sync\SYNCBUS\Synchronization Service\UIShell”, or ““%Program Files%\Windows Azure Active Directory Sync\SYNCBUS\Synchronization Service\UIShell” if you’re using Azure, you will find “miisclient.exe”:

miisclient.exe location

Open “miisclient.exe” and click the “Management Agents” tab:

Management Agents tab

Right-click “Source AD” and choose “Properties”:

SourceAD Properties

In the new window, choose “Configure Attribute Flow”, and expand “Object Type: user”:

Object Type: User Expanded2

Under “Object Type: user” click “msExchUCVoiceMailSettings” once. At the Build Attribute Flow window below, uncheck the “Allow Nulls” box:

Allow Nulls

Click OK, and close the MIIS client.

Re-enable the user for hosted voicemail, then resync. The user’s HostedVoiceMail setting will remain unchanged.