Bulk Change User UPN Address with Powershell

In order to Bulk change all users’s UPN Address in a single OU do the following:

Import-Module ActiveDirectory

$oldSuffix = "oldDomain.com"

$newSuffix = "newDomain.com"

$ou = "OU=Users,OU=office,DC=dcname,DC=local"

Get-ADUser -SearchBase $ou -filter * | ForEach-Object {

$newUpn = $_.UserPrincipalName.Replace($oldSuffix,$newSuffix)

$_ | Set-ADUser -UserPrincipalName $newUpn

}