Home > Exchange, Powershell, Scripting > Exchange 2010 Bulk Mailbox moves

Exchange 2010 Bulk Mailbox moves

Exchange and Powershell allows administrators much greater flexibility and the power to perform operations easily with one or two simple commands. The following commands are ones that I use to assist me in the bulk migration of mailboxes.

Firstly I create a Universal Distribution Group that contains the users whos mailboxes I want to move. There are plenty of ways to perform mailbox moves and using distribution groups is one.
In the following example the group “Mailboxes to be moved” was used and I was moving the mailboxes to the Mailbox Database “Database01”.

Get-DistributionGroupmember -identity “Mailboxes to be moved” | new-moverequest -TargetDatabase Database01

To watch the progress of these moves I use the following commands

get-moverequest

get-moverequeststatistics -moverequestqueue “Database01” | sort-object status,displayname,percentcomplete,totalmailboxsize

To view further information and to identify the cause of any failures I use the following command to output the full moverequest report to a text file on the c: drive.

get-moverequeststatistics -moverequestqueue “mailbox database” -includereport | fl | out-file c:\get-moverequeststatistics.txt

There are many more options available that I haven’t gone into here including allow bad items and batch names, refer to: http://technet.microsoft.com/en-us/library/dd351123.aspx

Advertisements
Categories: Exchange, Powershell, Scripting
  1. Hiten
    January 19, 2011 at 12:59 am

    I have been giving the aboive ago and i get the following error

    The operation couldn’t be performed because object ‘Domain/OU/IT Dept/Exchange Move/DG NAME’ couldn’t be found on ‘DC.domain’.
    + CategoryInfo : NotSpecified: (0:Int32) [New-MoveRequest], ManagementObjectNotFoundException
    + FullyQualifiedErrorId : 82B77BF,Microsoft.Exchange.Management.RecipientTasks.NewMoveRequest

    I have logged on to DC mentioned and i can see the group there with all the members etc.

    any ideas?

    • January 19, 2011 at 8:26 am

      Use the first part of the command; Get-DistributionGroupmember -identity ‘GroupName’ and ensure the command outputs the members of your group correctly, if it doesn’t check your group name. Also check the group type and ensure it is Universal Group and not a Dynamic Distribution Group or a Global Security/Distribution Group. If your organization has multiple Active Directory domains, you may need to run the Set-ADServerSettings cmdlet with the ViewEntireForest parameter set to $true before running the Get-DistributionGroupMember cmdlet to view the entire forest.
      See here: http://technet.microsoft.com/en-us/library/aa996367.aspx

      • hiten
        January 19, 2011 at 7:43 pm

        Hi
        thanks for the reply. i ran the get-distributiongroupmember -identity “name” and it does show the correct members, so it seems to finding the DG. i also tried the set-adserverSettings with the -viewEntireForest True and i still get the same error.

        i have also tried the original command in the article with the -domainController switch and tried to point it to different DC’s but the error always seems to be same that it cant find the DG on the DC (not the DC i set in the -domainController switch but the original DC which is local to the server)

  2. hiten
    January 19, 2011 at 8:13 pm

    just a bit more information which might help.

    we are in a single domain. also where both exchange serverare held there use to be 2 DC’s one physical and one virtual. the physical went down about 2 weeks ago but is being rebuilt at the moment. could this be the cause?.

    the error says it cannot find the the DG on the virtual DC

  3. January 19, 2011 at 8:30 pm

    The syntax of the command is correct. What Service Pack or Update are you running? check this support kb, it’s an error in the EMC but could be related as your error message is very similar: http://support.microsoft.com/kb/981033

  4. hiten
    January 19, 2011 at 8:55 pm

    Currently we are not running any updates on the server. I will install SP1 and give it another go.

    would there be another way to move users in bulk to spesific databases. i have found a way to do it via script and a CSV ( which includes the user name and the database they are moving to) which works but is a bit of a long process in creating the CSV.

    Thanks again for all your help.

  5. January 19, 2011 at 10:28 pm

    There are lots of ways to move users in bulk over to Exchange 2010. Check out Paul Cunningham’s post on ExchangeServerPro, he goes through several different ways which may help you achieve your goals but I suspect SP1 will sort out your isssues.

    http://exchangeserverpro.com/move-mailboxes-exchange-server-2010

  6. hiten
    January 25, 2011 at 8:11 pm

    Hi

    I got this working in the end with SP 1 and a few other tweaks and it works great.. taking this a bit further could i use the above method with a schedule? if all the groups are set up and i want it to run out of hours… am i right in saying that i would need to put the command in a txt file and name it as a PS1 file and then set up a normal windows scheduled job to execute it at X o’clock?

  7. January 26, 2011 at 6:58 pm

    Glad to hear you got it working, scheduling mailbox moves could be done via a powershell script and scheduled tasks. Use the following command in a schedule task to execute a powershell script (‘C:\scripts\mailboxmove-script.ps1’) that contained your command.

    PowerShell.exe -PSConsoleFile “d:\Program Files\Microsoft\Exchange Server\v14\Bin\ExShell.Psc1” -Command “. ‘C:\scripts\mailboxmove-script.ps1′”

  1. No trackbacks yet.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: