Change or Update UPN for users of specific group in Active Directory

Here is a quick almost one liner in PowerShell to update/change UPN for users of specific group in Active Directory.

Lets say we need to change UPN for all users in group SALES 
– Old UPN is: corp.home.com
– New UPN is : home.com

Here is the liner:

Get-ADGroupMember "SALES" | %{ $UserObj = Get-ADUser $_; $OldUPN = $UserObj.UserPrincipalName; $NewUPN = $OldUPN.Replace("corp.home.com","home.com"); Set-ADUser $UserObj -UserPrincipalName $NewUPN }

That is all !