Off-boarding Exchange Online users who have never had an on-prem mailbox

Wow. Sorry for the long title on this one folks, but allow me to continue.

As regular readers of my occasional tech-tips posts will know, our organisation exists in a hybrid relationship with Exchange Online. Some users are in the cloud, some are on-premises as we migrate them. Occasionally a user will need to be off-boarded from the cloud back to Exchange on-premises. This is easy enough if the user was migrate from Exchange on-premises in the first place, but what about the scenario where the user’s mailbox was created directly in the cloud? There’s no on-prem mailbox to go back to, so you might think it would be a painstaking process of PST exports, removal of licenses, being mail-enabled on-prem and then PST imports… Well, you can do it that way, or you can try the following:

  1. Log into Exchange Online PowerShell and run the following command to get the mailbox GUID:
    Get-Mailbox | Select ExchangeGuid
  2. Remove all the dashes from the GUID
  3. Generate a new value for the user’s legacyExchangeDN attribute. You can copy the value of an existing on-premises user, just change the CN= value at the end to the user’s sAMAccountName or name value, e.g.:
    /o=First Organization/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=User1

Once you have these values, you can run the following two PowerShell commands after importing the Active Directory module to set the values:

Set-ADUser user1 –Replace @{msExchMailboxGuid=[GUID]'d2cd81e6be4a46b48bc6655cfaad86d9'}

Set-ADUser user1 –Replace @{legacyExchangeDN="/o=First Organization/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=User1"}

Obviously, you’ll need to substitute the values in the examples for msExchMailboxGuid and legacyExchangeDN for the real values you generate for your own users. Once the necessary syncs have taken place and the object is up to date, you will be able to create an off-boarding migration batch to move the cloud mailbox back on-premises.

Share and Enjoy:
  • Digg
  • StumbleUpon
  • Technorati
  • Twitter
  • blogmarks
  • HackerNews
  • Tumblr
  • Posterous
  • email
Bookmark the permalink. Follow any comments here with the RSS feed for this post.
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

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

This blog is kept spam free by WP-SpamFree.