Populate ProxyAddresses when migrating to Office 365

We’ve had a couple of customers with a hosted Lync/SfB installation and Exchange Online where the users don’t have the ProxyAddresses field declared, and as a result, the users have EWS integration problems. The most noticeable for users is that their conversation history folder doesn’t capture history beyond the point where they migrate to Exchange Online.

This may be fairly unique to us, as we build hosted Skype for Business environments which ADSync user details back from the customer’s onsite active directory to ours. When they sync to 365, they’ll generally do it from their AD as well, so there’s a bit of a disconnect.

To fix the problem, either manually go through each user and add their default SMTP address to the ProxyAddresses field, or use the following script:

Import-Module ActiveDirectory
$domainController = 'dc1.contoso.com'
$searchBase = 'OU=users,DC=contoso,DC=com'
$users = Get-ADUser -SearchBase $searchBase -SearchScope Subtree -Filter { ObjectClass -eq "user" } -Properties ProxyAddresses
ForEach ($user in $users) {
 $newSMTP = 'SMTP:' + $user.userprincipalname
    Write-Host "Adding $newSMTP to" $user.SamAccountName
 Set-ADUser -identity $user.DistinguishedName -Add @{ProxyAddresses = $newSMTP} -server $domaincontroller
}

This script will run through the list of users in a specified OU and add the user’s default SMTP address by using their UserPrincipalName. If your users’ SMTP addresses don’t match your UserPrincipalName, and instead are samaccountname@domain.com, substitute the following for the $newSMTP variable:

$newSMTP = 'SMTP:' + $user.SamAccountName + '@contoso.com'
Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s