none
How to check if mailbox is already migrated before mailbox migration to HYbrid 365 RRS feed

  • Question

  • Hello

    I followed following url it seems to be working

    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/470b39ac-1bac-4f29-8d2d-b0ccf349e648/automating-office-365-user-licensing-and-mailbox-moves-to-the-cloud-in-hybrid-environment?forum=ITCG 

    I have following query

    1. Should I enable license for each before mailbox migration or after mailbox migration?

    2. How do I check if user mailbox is already migrated?

    Pleas advise

    Avian

    Wednesday, August 10, 2016 8:19 AM

Answers

  • Do you have DirSync such as Azure AD Connect enabled, and did Azure AD Connect create the users in Office 365?  If the answer is "yes":

    1. It doesn't matter.

    If the answer is "no" and the mailbox was created before DirSync was enabled and you subsequently removed the license:

    1.  You'd better license the mailbox after the move is complete because otherwise it's very possible that you will have problems with the move request or the mailbox disappearing.

    In either case:

    2. I haven't gone through that script.  In my script, I check to see whether the mailbox is already present.  If you try to create a move request for a mailbox that's already moved, it will fail.

    To check if a mailbox exists in Office 365 you can do something like this in Exchange Online PowerShell:

    $Mailbox = Get-Mailbox -Identity "Mailbox Name" -ErrorAction SilentlyContinue
    If ($Mailbox) {
      # Mailbox exists
    } Else {
      # Mailbox doesn't exist
    }


    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
    Celebrating 20 years of providing Exchange peer support!


    • Edited by Ed CrowleyMVP Thursday, August 11, 2016 5:49 AM
    • Marked as answer by Avian123 Thursday, August 11, 2016 7:30 AM
    Thursday, August 11, 2016 5:47 AM

All replies

  • Do you have DirSync such as Azure AD Connect enabled, and did Azure AD Connect create the users in Office 365?  If the answer is "yes":

    1. It doesn't matter.

    If the answer is "no" and the mailbox was created before DirSync was enabled and you subsequently removed the license:

    1.  You'd better license the mailbox after the move is complete because otherwise it's very possible that you will have problems with the move request or the mailbox disappearing.

    In either case:

    2. I haven't gone through that script.  In my script, I check to see whether the mailbox is already present.  If you try to create a move request for a mailbox that's already moved, it will fail.

    To check if a mailbox exists in Office 365 you can do something like this in Exchange Online PowerShell:

    $Mailbox = Get-Mailbox -Identity "Mailbox Name" -ErrorAction SilentlyContinue
    If ($Mailbox) {
      # Mailbox exists
    } Else {
      # Mailbox doesn't exist
    }


    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
    Celebrating 20 years of providing Exchange peer support!


    • Edited by Ed CrowleyMVP Thursday, August 11, 2016 5:49 AM
    • Marked as answer by Avian123 Thursday, August 11, 2016 7:30 AM
    Thursday, August 11, 2016 5:47 AM
  • Thanks Ed for clarification License part and on scripting part.

    As you suggested I will enable the license once the move is complete.

    I will test your code and share you the update, One question I am having UPN in my source file, Is it OK if use UPN with get-mailbox or should I use any other attribute. What do you recommend?

    I also saw in another post that I should use Get-RemoteMailbox with Remote Receipient Type and check the value if It is Migrated. Can you please advise on this?


    Avian


    • Edited by Avian123 Thursday, August 11, 2016 4:08 PM
    Thursday, August 11, 2016 7:30 AM
  • I only suggested that if you were using mailboxes on Office 365 accounts before DirSync created them or linked to them.  If you let DirSync create the user accounts in the cloud, then it shouldn't matter the order when you license them.

    I've never worried about if it's "Migrated".  If the move completes successfully, it changes the on-premises type to a remote mailbox.

    You're welcome, happy to have helped.


    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
    Celebrating 20 years of providing Exchange peer support!


    Thursday, August 11, 2016 5:42 PM