Migrate Mailbox to 365 using PowerShell

Migrating mailboxes to 365 using the GUI options or the website can be time consuming, especially if you have hundreds to do. (Of course, if you was doing batches of mailboxes you’d change this PowerShell to import from a file)

The following, connects to your on premise exchange server, and then connects to your 365 tenant and initiates the transfer of the mailbox.

Note – the on premise exchange server (in my case at least) required credentials in the DOMAIN\USERNAME format, the 365 admin credentials are passed in full UPN format.

Once the above job has been queued, your PowerShell will return to the prompt. If you’d like to get the status of this, or any other move requests currently taking place you can use the Get-MoveRequest commandlet and pipe it to Get-MoveRequestStatistics as per the below

Read More

Use Set-Mailbox to add email alias based on Get-Mailbox Filter

logo-powershellThe company who I work for are currently in the process of migrating away from Exchange on premise and over to Office 365. Now, 95% of our ActiveDirectory records are set to inherit the mail recipient policy – the other 5% have been excluded for one reason or another.. As the technical lead on the project, I had to come up with a way to add the new/required email address to all mail accounts prior to migration. Which is there this little PowerShell script was born.. I must admit, I have somewhat of a love/hate relationship with PowerShell, I understand its powerful, and that things have to change.. Its just taking me sometime to get used to it.. Anyway, this is what I have so far, it may well be that it could be tweaked somewhat, so if you have any suggestions please do let me know!

Steps involved

  1. Search Exchange for all mailboxes with the inherit flag unticked
  2. Build the new email address using Firstname.Lastname
  3. If the first name and last name fields are blank in AD, build the address using the display name.
  4. Strip any spaces out of the name, and replace with full stops
  5. Finally – add the new mail address to the Exchange Object

Read More

PowerShell: Assign Office 365 license en-mass

Last week I was tasked with the challenge of assigning a sharepoint only license from our Office 365 license pool to a large list of staff.

The following PowerShell script is what I came up with – I added the ability to prompt before assignment, just in case a UPN had slipped through my pre scripting filtering.

This script relies on a CSV file of user principal names, one column – titled UserPrincipalName


Currently, the script assigns a full set of 365 licenses, then removes all but the one the user requires – future plans are to just assign whats required.

Read More