Skip to content

Instantly share code, notes, and snippets.

@jespernohr
Created October 26, 2015 15:12
Show Gist options
  • Save jespernohr/dcf527c34067935fdcf1 to your computer and use it in GitHub Desktop.
Save jespernohr/dcf527c34067935fdcf1 to your computer and use it in GitHub Desktop.
# use this script to add the userprincipalname as pimary SMTP to the proxyaddress attribute of a user object.
$users = Get-ADUser -Filter {EmailAddress -like "example@domain.com"}
foreach($item in $users)
{
$UPN=$item.UserPrincipalName
write-host $UPN
set-aduser -identity $item -add @{proxyAddresses="SMTP:"+$UPN}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment