AntiMalware Status

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

Here is a quick almost one liner in [easyazon_link identifier=”B07883YKV1″ locale=”US” tag=”wn0d5-20″] PowerShell [/easyazon_link] to update/change UPN for users of specific group in [easyazon_link identifier=”1449361420″ locale=”US” tag=”wn0d5-20″]Active Directory [/easyazon_link].

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