This situation may come true if you have Onpremises Exchange and Online tenant Lync.

Then you need to add a SIP address with the same name as the user is in the Online tenant.

And here’s the script:

$mailboxes = Get-Mailbox -OrganizationalUnit contoso.local/Users/someOU
foreach ($mailbox
in $mailboxes)
{Set-Mailbox -Identity
$mailbox -EmailAddresses
(($mailbox.emailaddresses)
+=”SIP:$($mailbox.alias)@domain.fi”) 
}

If you want to add multiple domains just copy / paste the line and alter the domain.fi part.

Happy Powershelling!