Office 365 Migration – User Attribute Discovery and Export using Powershell

Identity is key. I cannot emphasise this enough as you begin to move workloads into Exchange Online, SharePoint Online and Skye for Business Online. One of the first pieces of advice you should have been given is the user UPN should match the primary SMTP address. Here is why:-

  1. The UPN in Office 365 becomes the default SIP address in Skype for Business Online.
  2. Office (inc Office for IOS) and OneDrive require the UPN to match the email address.

For a good place to start sanitising your Active Directory, and if you have not already done so, look into “

“It’s easy to get userPrincipalName (on-premises and in Azure Active Directory) and the primary email address in proxyAddresses set to different values. When they are set to different values, there can be confusion for administrators and end users”

Matching UPN to the Primary SMTP is not a requirement but it makes things a lot easier for you and your users.

This post is in danger of losing focus so let me get back on track.

I wanted to check the following attributes for users before I consider migrating their mailbox to Exchange Online:-

  1. UPN
  2. SAM Account Name
  3. Primary SMTP Address
  4. SMTP Addresses (to see if they had been given a address)

UPN and Primary SMTP Address are very important to me, i need to ensure these match. I would like to see the Sam Account Name – this is what my users can carry on using to log into on premise apps/computers. I also want to check if my users have been allocated an smtp address from the Exchange Email Address Policy (Policy created during Exchange Hybrid Configuration – some users have the tick box unchecked “Automatically Update e-mail addresses based on e-mail address policy” and this would have prevented them from getting a [email protected] address).

One way of checking your user attributes is to use PowerShell. The following script will take information from Active Directory and Exchange On-Premise and output to a CSV.

The script does not modify data, it manipulates objects outputted by the cmdlets and exports the results to a CSV

This code should be tested before being applied to a production environment

5/5 - (1 vote)

1 thought on “Office 365 Migration – User Attribute Discovery and Export using Powershell”

  1. Pingback: Office 365 Migration - Adding additional UPNs

Leave a Comment

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.


This site uses Akismet to reduce spam. Learn how your comment data is processed.