Link to home
Start Free TrialLog in
Avatar of Rick_Penney
Rick_Penney

asked on

Powershell script to change UPN

Hi, our users current UPN is    first initial + Surname  @domainname.local
I have added an additional UPN suffix and need to change the users UPN to  firstname.lastname @domainname.net

Does anyone have a powerscript that will change both aspects of the UPN?
kind regards
Rick

Avatar of oBdA
oBdA

Changing the UPN is not really complicated; but ...
* About how many accounts are there? Tens, hundreds, thousands?
* Are you sure that firstname.lastname is unique for all accounts where the UPN needs to be changed? If there are duplicates, what's supposed to happen?
* How are the accounts determined that need to be changed; by OU? Are there accounts that shouldn't be processed (like service accounts, for example)?
Avatar of Rick_Penney

ASKER

Hi, many thanks for your quick reply.
There are approx 300 users that need changing that are in various child OUs, so i would do them in blocks and change the script to suit each time. The child OUs only contain valid users and not service accounts.
We need to do this in preparation for moving to Office 365 which we plan to sync On Prem AD with Azure AD.
I will check, but pretty confident we don't have any users with the same first and last names
regards

ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Worked a treat, very much appreciated
A++
Hi, the script as i say worked perfectly, however we have had approx 10-15% of AD accounts lock out after the workstation goes back to the login screen after the 15 minute GPO timeout.
We are just resetting the users passwords and they can log back in, however, we have had the same accounts lock out more than once after inactivity
Any ideas?
regards
Rick