Solved

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

Posted on 2011-02-24
3
371 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
  • 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

860 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