Changing AD UPN in bulk using Powershell GUI
Almost every Office 365 migration has the same step involved every time: changing the UPN suffix of all the users from a non-routable (local) domain to a routable, public domain.
Most of the time you change the UPN from firstname.lastname@example.org to email@example.com. Changing this all manually is really cumbersome, there are plently of Powershell scripts out there, but none fit my needs.
Because I have been looking into Powershell GUI’s, I decided to combine them both. The result of this works can be found in the following script on GitHub.
This script will let you dynamically choose which UPN’s you want to update and what suffix to use. All of this is done through a Powershell GUI
It starts off by asking you which users you want to target.
As you can see, there are three choices:
- Update all users from a specific OU
- Update all users from a CSV
- Update all users in the entire forest
When choosing for the OU option, you are greeted with a fully functional OU picker module. Credits for this go out to ITMICAH, he created this wonderful piece of code.
With this option, you can visually pick the OU you want to and choose ‘OK’ when you are done.
The CSV option is also straightfoward. Just browse to the CSV file you want to use and click open.
Selecting the AD option will update all the users in the AD forest.
After selecting one of the three options, you are asked to pick the desired UPN Suffix:
It then asks you to confirm the desired suffix, select ‘No’ to cancel.
If you select ‘Yes’ the script will begin looping over all the users you have selected and change the UPN’s.
If you have any questions about this, feel free to reach out by leaving a comment.
Leave a Reply