Recipe17.16.Moving a Mailbox


Recipe 17.16. Moving a Mailbox

Problem

You want to move a mailbox to a new database, storage group, or server.

Solution

Using a graphical user interface

  1. Open the ADUC snap-in.

    This needs to be run on a workstation or server that has the Exchange Management Tools loaded (see Recipe 17.6).


  2. If you need to change domains, right-click on Active Directory Users and Computers in the left pane, select Connect to Domain, enter the domain name, and click OK.

  3. In the left pane, browse to the parent container of the user, right-click on the user, and select Exchange Tasks.

  4. On the Welcome screen, click Next.

  5. Select Move Mailbox and click Next.

  6. Select new values for Server and Mailbox Store and click Next.

  7. Select how you want to handle corrupted messages and click Next.

  8. Specify when to start processing the move task and click Next.

  9. When the Completed screen is shown, click Finish. If there are errors, select the View Detailed Report checkbox to get a failure report.

Using a command-line interface
> exchmbx -b <UserDN> -move "<server>:<storage group>:<mail store>"

Or alternatively, run the following command:

> exchmbx -b <UserDN> -move "<Home MDB URL>"

Replace <UserDN> with the user's distinguished name, <server> with the Exchange server name, <storage group> with the storage group, <mail store> with the mail store, and <Home MDB URL> with the full homeMDB URL for the desired mailbox store.

To move an existing mailbox for user joe to Exchange Server Srv1, Storage group SG1, and mailbox store DB1, execute the following command:

> exchmbx -b "cn=joe,cn=users,dc=rallencorp,dc=com" -move "srv1:sg1:db1"

Using VBScript
' This code moves a mailbox. ' ------ SCRIPT CONFIGURATION ------ strUserDN  = "<UserDN>" ' e.g., cn=jsmith,cn=Users,dc=rallencorp,dc=com  strServer  = "<Exchange Server>"         ' e.g., ExchServer2 strSGName  = "<Storage Group Name>"      ' e.g., SG1 strMailStoreName = "<MailBox Store Name>" ' e.g., DB1 ' ------ END CONFIGURATION --------- ' Find Storage Group URL and Generate Mailbox Store URL strSearch = "cn=" & strSGName  & "," set objSrv = CreateObject("CDOEXM.ExchangeServer") objSrv.DataSource.Open strServer for each strSg in objSrv.StorageGroups    if (instr(1,strSg,strSearch,1)>0) then        strSGUrl = strSg          exit for    end if next  strMBUrl = "LDAP://cn=" & strMailStoreName & "," & strSGUrl     ' Attach to user and move mailbox set objUser = GetObject("LDAP://" & strUserDN) objUser.MoveMailbox(strMBUrl) Wscript.Echo "Successfully moved mailbox."

Discussion

Mailbox moves are commonly done in many Exchange organizations due to servers getting upgraded, server hardware issues, users migrating from Exchange 5.5 to Exchange 2003, or the administrators wanting to readjust mailbox location for load balancing.

Moving a mailbox requires Exchange Service Administrator permissions plus additional permissions on user objects. See the Discussion for Recipe 17.7 and MS KB 842033.


A mailbox move is an odd operation in terms of permissions. Logically, moving a mailbox is basically a combination of create and delete operations, which is something an Exchange Data Administrator can do just fine. However, to actually move a mailbox, you must have Exchange Administrator Role permissions with a subset of the permissions Exchange Data Administrator have on users. See MS KB 842033 for details of the permissions needed.

If you don't handle user mailbox administration through an automated web site, I recommend that you delegate permissions to the attributes listed in the knowledge base articles to some Active Directory group. Once delegated, add the Exchange Administrator Role users to that group and have them handle all mailbox moves.

Using a graphical user interface

The move mailbox wizard is the only Exchange wizard that allows you to schedule when the changes will be made. This is obviously a handy feature for mailbox moves because it isn't something you generally want to do midday. This allows Exchange administrators who like to sleep at night to schedule the work to be done, and go home with everyone else.

Using a command-line interface

Prior to the ExchMbx tool, there was no simple way to move a mailbox from the command line. The command structure to move a mailbox is similar to the command structure to create a mailbox (see the command-line solution in Recipe 17.11).

If you want to move multiple mailboxes at once, remove the -b option from the parameter list and pipe the distinguished names into ExchMbx from another tool or from a file. Run exchmbx /? for usage details.


Using VBScript

The trickiest part of moving a mailbox for a user is to know what the Home MDB URL is for the database where you want to move the user. The method used here allows you to specify three well-known components and arrive at the answer. In Recipe 17.11, I use another method to do this by entering the exact value for the mailbox store URL. A third alternative would be to search Active Directory for all valid homeMDB values, display them, and have the person running the script select from the list like ADUC does. To get the list of mailbox store URLs, search against the Configuration container in Active Directory (e.g., cn=Configuration,dc=rallencorp,dc=com) with the following filter (objectCategory=msExchPrivateMDB).

See Also

MS KB 842033 ("Access Denied" error message when you move mailboxes by using the Exchange Task Wizard in Exchange Server 2003), MS KB 316792 (Minimum permissions necessary to perform Exchange-related tasks), and MS KB 821829 (Moving Mailboxes in Exchange Server 2003)



Windows Server Cookbook
Windows Server Cookbook for Windows Server 2003 and Windows 2000
ISBN: 0596006330
EAN: 2147483647
Year: 2006
Pages: 380
Authors: Robbie Allen

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net