Solved

Move Mailbox Powershell Script Questions

Posted on 2009-07-01
3
815 Views
Last Modified: 2012-06-21
We are in the process of upgrading to Exchange 2007.  When a user is created our tech desk has not done a good job of creating the mailbox in the correct store.  So I am doing a cleanup now to move mailboxes to their correct stores.  Going forward I would like to have a powershell script run weekly to move and misconfigured mailboxes. Here is the command

Get-Mailbox -OrganizationalUnit "SAIUsers" -Filter "Department -eq 'IS'" |Move-Mailbox -TargetDatabase "ISStore"


My questions are
1. Will this work?
2. Can that be piped to a log file of some kind?
3. What would you recommend for Users that do not have the department attribute set?  I need to get a list so i can send it to the tech desk for fixing.


The exchange serves are running on 2008 boxes and the domain is 2003.
0
Comment
Question by:SAIonline
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 27

Expert Comment

by:shauncroucher
ID: 24755994
1) Yes, this command should work fine. You can clarify what results you will get with this command by appending -whatif to the end of the command.

2) | out-File filename.txt should output to a text file

3) It depends what users you are trying to filter for? If you want to filter for all those with Department eq to IS then thats fine. What do you mean those that don't have the dept att set? Well, you could catch all those that do not have any department set by using -eq "" I guess?

Shaun
0
 
LVL 2

Author Comment

by:SAIonline
ID: 24756233
Thank you for the output.  I did figure out that you have to user get-user to use the department filter.  

My plan is to have a line for each department.  If the mailbox is already in the correct store it won't do anything.  (this should be the majority of users.)  If it is not, move the mailbox to the correct store.

The last line would be the one that searches for any blank departments and outputs to a text file.  I think you answered that one too.
Get-User -OrganizationalUnit "SAIUsers" -Filter "Department -eq ''" | out-File filename.txt

Does that look correct?
0
 
LVL 27

Accepted Solution

by:
shauncroucher earned 500 total points
ID: 24756663
For users that don't have a department set AT ALL (so blank) you would need to type  the following:

-Filter "Department -ne '*'" (In other words, not equal to anything. :S)

That should do the trick though!

Shaun
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For anyone that has accidentally used newSID with Server 2008 R2 (like I did) and hasn't been able to get the server running again because you were unlucky (as I was) and had no backups - I was able to get things working by doing a Registry Hive rec…
Group policies can be applied selectively to specific devices with the help of groups. Utilising this, it is possible to phase-in group policies, over a period of time, by randomly adding non-members user or computers at a set interval, to a group f…
This video discusses moving either the default database or any database to a new volume.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question