Move only mailboxes below a certain size (via powershell)
I use the following command to get all mailboxes below a certain size from a specific database: Get-Mailbox -database database_db10 | get-mailboxstatistics | where {$_.TotalItemSize -lt 10MB} This returns the correct data (all mailboxes less than 10Mb) but when I try to then pipe that to a new-moverequest I'm getting an error: Command: Get-Mailbox -database database_db10 | get-mailboxstatistics | where {$_.TotalItemSize -lt 10MB} | new-moverequest -targetdatabase database_db12 Error: Cannot process argument transformation on parameter 'Identity'. Cannot convert the "2db1965d-9f45-44cd-b9ad-ccf76895d391" value of type "Microsoft.Exchange.Data.Mapi.MailboxId" to type "Microsoft.Exchange.Configuration.Tasks.MailboxOrMailUserIdParameter".+ CategoryInfo : InvalidData: (Microsoft.Excha...ilboxStatistics:PSObject) [New-MoveRequest], ParameterBindin...mationException+ FullyQualifiedErrorId : ParameterArgumentTransformationError,New-MoveRequest It looks like it's passing the ExchangeGUID instead of the mailbox alias. Is there another way to do this (move only mailboxes less than a certain size)? Were migrating 2003 mailboxes but the log luns are only 20gb so we need an easy way to only select about 10gb of mailboxes to move each night (from each database). Too bad the mailbox size is not exposed in the EMC as this would be easy to do this from there. Thanks.
January 13th, 2012 1:58pm

Hi tbooher, To first answer your question, you should be able to accomplish the task by turning around your script a little bit so it looks like this: Get-MailboxDatabase database_db10 | get-mailboxstatistics | where {$_.TotalItemSize -lt 10MB -AND $_.DisplayName -notlike "SystemMailbox*"} | get-mailbox | New-MoveRequest -TargetDatabase database_db12 There are probably other ways to accomplish your end goal as well. Here's a good article on balancing mailboxes across Exch10 (and Exch07) databases, if it helps at all: http://www.stevieg.org/2010/09/balancing-exchange-databases/ -Matt
Free Windows Admin Tool Kit Click here and download it now
January 13th, 2012 3:15pm

Thanks for the tip on changing the order, that did the trick. I'll take a look at the URL as well. Todd
January 13th, 2012 4:37pm

This did not work for me on SP2, i get all mailboxes even if i specify a specific database with -Database or a specific server with -Server. Any clues? Edit: Actually, this may be because of uncleared completed move requests. I will clear those and try the command again. Edit2: Same thing happens after clearing all completed move requests. Forgot to say we have two sites and i tested the command in both. Last site replication was 15 minutes ago so it isn't that.
Free Windows Admin Tool Kit Click here and download it now
May 23rd, 2012 12:06pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics