The task is to change the Exchange Server DAG witness server to another server. Why…
Migrate Exchange mailboxes through text file
You want to migrate users to a new database or new Exchange Server. You can migrate mailboxes with the Exchange Admin Center (EAC) and select the users one by one or work with PowerShell. This article will show you how to migrate Exchange mailboxes through a text file with PowerShell. This way, you can make multiple text files with users and migrate each batch to an Exchange mailbox database.
Table of contents
Configure the text file
Open up Notepad and fill in the e-mail addresses that you want to migrate.
Save it as a text file called migrate1.txt and place it in the following path C:\migrate on your Exchange Server. If you don’t have a folder called migrate, create it.
Do you need a list of all the mailboxes in a database or entire organization? Have a look at the article get mailbox sizes in PowerShell Exchange.
Read the text file
Run Exchange Management Shell as administrator. Change directory to the migrate folder path and read the text file. It will display the content of the text file.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
[PS] C:\>cd C:\migrate [PS] C:\migrate>Get-Content migrate1.txt john.doe01@alitajran.com john.doe02@alitajran.com john.doe03@alitajran.com john.doe04@alitajran.com john.doe05@alitajran.com john.doe06@alitajran.com john.doe07@alitajran.com john.doe08@alitajran.com john.doe09@alitajran.com john.doe10@alitajran.com |
List the databases included count mailboxes
Before you move mailboxes, it’s always good to verify the target mailbox database. Run the following command to list the databases in the organization.
1 2 3 4 5 6 7 8 9 |
[PS] C:\migrate>Get-Mailbox -ResultSize Unlimited | Group-Object -Property:Database | Select-Object Name,Count | Sort-Object Name | Format-Table -Auto Name Count ---- ----- DB01 20 DB02 31 DB03 46 DB05 55 DB06 29 |
Migrate mailboxes through a text file to a particular database
Suppose you want to migrate the mailboxes to the DB03 database, run the command with the -WhatIf parameter placed at the end. The -WhatIf parameter allows you to see what will happen if you run the command. No changes will be made.
1 2 3 4 5 6 7 8 9 10 11 |
[PS] C:\migrate>Get-Content migrate1.txt | New-MoveRequest -TargetDatabase DB03 -WhatIf What if: Creating move request "alitajran.local/AT/Users/Standard/Doe01 John". What if: Creating move request "alitajran.local/AT/Users/Standard/Doe02 John". What if: Creating move request "alitajran.local/AT/Users/Standard/Doe03 John". What if: Creating move request "alitajran.local/AT/Users/Standard/Doe04 John". What if: Creating move request "alitajran.local/AT/Users/Standard/Doe05 John". What if: Creating move request "alitajran.local/AT/Users/Standard/Doe06 John". What if: Creating move request "alitajran.local/AT/Users/Standard/Doe07 John". What if: Creating move request "alitajran.local/AT/Users/Standard/Doe08 John". What if: Creating move request "alitajran.local/AT/Users/Standard/Doe09 John". What if: Creating move request "alitajran.local/AT/Users/Standard/Doe10 John". |
Run the command without the -WhatIf parameter to migrate the mailboxes to the database.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[PS] C:\migrate>Get-Content migrate1.txt | New-MoveRequest -TargetDatabase DB03 DisplayName StatusDetail TotalMailboxSize TotalArchiveSize PercentComplete ----------- ------------ ---------------- ---------------- --------------- Doe01 John WaitingForJobPickup 5.063 KB (5,184 bytes) 0 Doe02 John WaitingForJobPickup 2.423 MB (2,540,313 bytes) 0 Doe03 John WaitingForJobPickup 302.3 KB (309,603 bytes) 0 Doe04 John WaitingForJobPickup 4.377 MB (4,589,389 bytes) 0 Doe05 John WaitingForJobPickup 231.6 MB (242,877,775 bytes) 0 Doe06 John WaitingForJobPickup 3.148 GB (3,379,905,224 bytes) 0 Doe07 John WaitingForJobPickup 1.246 GB (1,337,894,754 bytes) 0 Doe08 John WaitingForJobPickup 5.301 GB (5,691,380,553 bytes) 0 Doe09 John WaitingForJobPickup 498.9 MB (523,091,486 bytes) 0 Doe10 John WaitingForJobPickup 5.32 GB (5,711,868,104 bytes) 0 |
Suspend the migration
If you want to suspend (pause) the migration, use the Suspend-MoveRequest cmdlet.
1 2 3 4 5 6 7 |
[PS] C:\migrate>Get-Content migrate1.txt | Suspend-MoveRequest Confirm Are you sure you want to perform this action? Suspending move request "Doe01, John". Suspending this move request will prevent data from being replicated until it is manually resumed by using the Resume-MoveRequest cmdlet. [Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): A |
Verify the suspend status
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[PS] C:\migrate>Get-Content migrate1.txt | Get-MoveRequest | Get-MoveRequestStatistics DisplayName StatusDetail TotalMailboxSize TotalArchiveSize PercentComplete ----------- ------------ ---------------- ---------------- --------------- Doe01 John Suspend 5.063 KB (5,184 bytes) 20 Doe02 John Suspend 2.423 MB (2,540,313 bytes) 15 Doe03 John Suspend 302.3 KB (309,603 bytes) 10 Doe04 John Suspend 4.377 MB (4,589,389 bytes) 10 Doe05 John Suspend 231.6 MB (242,877,775 bytes) 10 Doe06 John Suspend 3.148 GB (3,379,905,224 bytes) 10 Doe07 John Suspend 1.246 GB (1,337,894,754 bytes) 10 Doe08 John Suspend 5.301 GB (5,691,380,553 bytes) 10 Doe09 John Suspend 498.9 MB (523,091,486 bytes) 10 Doe10 John Suspend 5.32 GB (5,711,868,104 bytes) 10 |
Resume the migration
When you want to resume the migration, make use of the Resume-MoveRequest cmdlet.
1 |
[PS] C:\migrate>Get-content migrate1.txt | Resume-MoveRequest |
Check status of the migration
Run the following command to check the status of the migration.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[PS] C:\migrate>Get-Content migrate1.txt | Get-MoveRequest | Get-MoveRequestStatistics DisplayName StatusDetail TotalMailboxSize TotalArchiveSize PercentComplete ----------- ------------ ---------------- ---------------- --------------- Doe01 John CopyingMessages 5.063 KB (5,184 bytes) 23 Doe02 John CopyingMessages 2.423 MB (2,540,313 bytes) 22 Doe03 John CopyingMessages 302.3 KB (309,603 bytes) 45 Doe04 John CopyingMessages 4.377 MB (4,589,389 bytes) 31 Doe05 John CopyingMessages 231.6 MB (242,877,775 bytes) 84 Doe06 John CopyingMessages 3.148 GB (3,379,905,224 bytes) 73 Doe07 John Completed 1.246 GB (1,337,894,754 bytes) 100 Doe08 John Completed 5.301 GB (5,691,380,553 bytes) 100 Doe09 John Completed 498.9 MB (523,091,486 bytes) 100 Doe10 John Completed 5.32 GB (5,711,868,104 bytes) 100 |
You can also check if the e-mail addresses in the text file got migrated to the target database.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[PS] C:\migrate>Get-Content migrate1.txt | Get-Mailbox | Format-Table Name, Database Name Database ---- -------- Doe01 John DB03 Doe02 John DB03 Doe03 John DB03 Doe04 John DB03 Doe05 John DB03 Doe06 John DB03 Doe07 John DB03 Doe08 John DB03 Doe09 John DB03 DOe10 John DB03 |
The mailboxes migrated successfully to the target database. Did you migrate a text batch with mailboxes to a database in Exchange?
Keep reading: Export a list of mailboxes to text in Exchange »
Conclusion
In this article, you learned how to migrate Exchange mailboxes through a text file. Migrating mailboxes with a text file in Exchange is excellent to do. Exact steps and the right approach is essential if you need to migrate a lot of users. If you can make batches of the mailboxes in text files and select a target database for each batch, you can migrate fast. It’s also nice that you can quickly verify if the mailboxes in the text file got migrated to the target database.
Did you enjoy this article? You may also like Exchange 2010 end of life support is coming. Don’t forget to follow us and share this article.
This Post Has 0 Comments