Simple PowerShell one-liner –
1 |
Get-ADGroupMember "GroupIWantToTarget" | %{ $UserObj = Get-ADUser $_; $OldUPN = $UserObj.UserPrincipalName; $NewUPN = $OldUPN.Replace("oldupnsuffix.com","newupnsuffix.com"); "$OldUPN -> $NewUPN"; Set-ADUser $UserObj -UserPrincipalName $NewUPN } |
The "$OldUPN -> $NewUPN";
can be skipped. That’s just for me to get output of the changes being done.