I just need to move the first 10 Mailboxes in exchange ? Wow what a question :)
I was working on a case today with one of my team member and the customer asked us a question
I just need to move the first 10 Mailboxes in exchange ?
Now after a lot of thoughts I was able to get to the requirement what the customer had asked :)
This can be done in the following way.
$a= get-mailbox -Database "mailbox database" | Select-Object name -First 10
Now if we Just type $a I should be just getting the names of the first 10 mailboxes on the mailbox database
Your output would be something like this
Name
----
Administrator
User1
User2
User3
USer4
User5
User6
User7
User8
User9
Lets assume that
we want to move the databases from Mailbox Database to a database called Testdb.
In exchange 2007 We would be using the following command
foreach ($b in $a) {Move-Mailbox -Identity $b.name -TargetDatabase testdb}
In exchange 2010 We would be using the following command
foreach ($b in $a) {New-moverequest -Identity $b.name -TargetDatabase testdb}
If you need to move the first 100 just change the value after -first from 10 to 100
More to come on this blog :)
Written by:
Naveen Vasudevan, Technical Lead, Enterprise Communications Services, Microsoft
Have fun with Powershell and exchange :)