Solved

Move mailboxes querying the ntaccount name in a txt file. In exchange 2007.

Posted on 2011-02-24
3
373 Views
Last Modified: 2012-06-27
Hi,

Move mailboxes querying the ntaccount name in a txt file. In exchange 2007.

I want help with a script that can check each user name in the txt file and move mailboxes from one server store to another server store.

A log file if possible with success and failure.

regards
Raja
0
Comment
Question by:bsharath
[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 16

Accepted Solution

by:
Dale Harris earned 500 total points
ID: 34977258
I just did this with a CSV I exported from our Exchange.

Let's say you have a CSV outputted with alias for each one.  That means it can be queried through your AD by using "Domain\$alias".  If this doesn't work, then you will have to adjust accordingly.

So what I did was set up the variable to hold all of the accounts:

$Accounts = import-csv "C:\Users.csv"

Then you can simply do whatever you want with this information now:

$Accounts | %{move-mailbox -identity "Domain\$($_.alias)" -targetdatabase "$TargetDB"}

This is assuming that above the fields you want to use, is the word alias.

Now if you were doing a text file, I would do:

$Accounts = get-content "C:\TextFile.txt"

And the code would change just a little to the below:
$Accounts | %{move-mailbox -identity "Domain\$_" -targetdatabase "$TargetDB"}


HTH,

Dale Harris
0
 
LVL 16

Expert Comment

by:Dale Harris
ID: 34977266
Forgot to add this bit:

You can run this in the Powershell window, and it will return errors as it tries to move accounts if it encounters any.

This is a pretty straight forward issue, but if you really wanted to keep track in a text file, you could look into using the Start-Transcript and Stop-Transcript commands.  This will capture anything in the window.

DH
0
 
LVL 11

Author Comment

by:bsharath
ID: 34977270
Thanks for the reply

Can you give me combined code please to try
0

Featured Post

Independent Software Vendors: 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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

752 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