Exchange 2007 Mailbox move powershell script help please
Hi there, We are starting a migrationfrom Exchange 2000 to 2007, and I'm pretty new to powershell. I have 4x Exch 2000 servers and want to move all the mailboxes from 2 Exch 2000 servers on to 1 Exch 2007 server on the same site. I need to exclude all mailboxes from other servers (on remote sites). However, we have planned to split the users in to 2 stores, defined by the first letter of their lastname. To achieve this, we have a mailbox store called "A-M" and one called "N-Z". My question is: What powershell command can I use to Get the mailboxes for the users with the lastname beginning with "a" (then b, then c...), from each of my 2 local servers, and Move them into the appropriate store? I have tried to use the Get-mailbox -servercmdlet piped to the get-user -filter {lastname "a*"} command, but I get errors saying that it doesn't accept the piped information. The get-user cmdlet doesn't seem to supporta -server parameter, so I don't think I can do it that way...but I'm happy to be corrected. I was hoping to then pipe the results from those two cmdlets to the Move-mailbox command, with the appropriate store as destination. Any advice or comments gratefully appreciated! Nick ps. I did wonder if it was possible to do something like get-mailbox -server servername {where object...), but I have no idea what the 'where' statement should be, and then pipe that to the Move mailbox command.
November 25th, 2008 1:55pm

Hi Nick, Below command should work for your all mailboxes start with A-M and similar command you can use for N-Z Get-Mailbox -Server ServerName | Get-User | where {$_.LastName -like "[a-m]*"} | Move-Mailbox ..
Free Windows Admin Tool Kit Click here and download it now
November 25th, 2008 5:32pm

Hi Amit, That was great. Thank you very much for your advice. Is there a reference guide for the where { } parameters available? The solution your provided was clean and simple, but I couldn't find the info, so thanks very much indeed. Nick
November 26th, 2008 5:22am

Hey Nick, -Filter filter the result at server side, means it first filters the result and then gives the output. While Where { } is used for filtering result at client side. Means it takes the result from previous command from server and then filters it and gives the output. pipe where { } filters the result based on the required equation mentioned inside { }. You can find further information in Client-Side Filtering session of below article. Working with Command Output http://technet.microsoft.com/en-us/library/bb123533.aspx
Free Windows Admin Tool Kit Click here and download it now
November 26th, 2008 8:49am

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

Other recent topics Other recent topics