Update UPN on multiple users


I recently did an LDIFDE import of a lot of users to a test domain, and the UPN is not sett on the user objects.

So to change/set the UPN for all my users in the test domain I used this little​ string. Worked like a charm

I gets all the users objects in the Domain Sameie.com, and it sets the UPN to username@sameie.info

Get-ADUser -searchbase “DC=sameie,DC=com” -filter * | foreach {set-adusers $_ -userprincipalname (“{0}@{1}” -f $_.samaccountname,”sameie.info”)}