Import-Module ActiveDirectory $oldSuffix = "myolddomain.local" $newSuffix = "mynewdomain.com" $ou = "DC=yourdomain,DC=local" $server = "Hostname" Get-ADUser -SearchBase $ou -filter * | ForEach-Object { $newUpn = $_.UserPrincipalName.Replace($oldSuffix,$newSuffix) $_ | Set-ADUser -server $server -UserPrincipalName $newUpn }