AntiMalware Status

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 !

Leave a Reply