Skip to content

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@domain.local to firstname.lastname@domain.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

OU

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.

CSV

The CSV option is also straightfoward. Just browse to the CSV file you want to use and click open.

AD

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.

Happy scripting!

If you have any questions about this, feel free to reach out by leaving a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: