Skip to content

Instantly share code, notes, and snippets.

@mortenya
Created September 14, 2016 21:04
Show Gist options
  • Save mortenya/ce646a8f50e523679739caf1f5e8aaf5 to your computer and use it in GitHub Desktop.
Save mortenya/ce646a8f50e523679739caf1f5e8aaf5 to your computer and use it in GitHub Desktop.
We didn't have an Exchange server on site with everyone's mailbox, and this was a requirement for migrating from GroupWise to Exchange Online.
$users = get-aduser -Filter * -Properties proxyAddresses,EmailAddress
foreach ($u in $users) {
if (!($u.proxyAddresses -contains "SMTP:$($u.EmailAddress)")) {
$u.proxyAddresses.Add("SMTP:$($u.EmailAddress)")
Set-ADUser -Identity $u.SamAccountName -Add @{ 'proxyAddresses' = $($u.proxyAddresses) }
}
else {
Write-Host "$($u.name) already had the correct proxyaddresses"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment