?
Solved

moving users from one storage group to another in exchange 2007

Posted on 2011-04-18
7
Medium Priority
?
693 Views
Last Modified: 2012-06-22
Hi ive been trying to move users (please see attachment) from one storage group to another using the script below.

$users =  Import-Csv sheeta.csv -Header (gc sheeta.csv)[0].trim(",").split(",") | select -skip 1
foreach ($user in $users) {move-mailbox $user.DisplayName -targetDatabase $user.targetdatabase}

I kept getting this error message. Am i doing something wrong with the script.  Thank you all.  Im running it in the exchange console

PS] C:\Documents and Settings\admin.jamiec>$users =  Import-Csv dat03.csv -Head
er (gc sheeta.csv)[0].trim(",").split(",") | select -skip 1
Get-Content : Cannot find path 'C:\Documents and Settings\admin.jamiec\sheeta.c
sv' because it does not exist.
At line:1 char:43
+ $users =  Import-Csv dat03.csv -Header (gc <<<<  sheeta.csv)[0].trim(",").spl
it(",") | select -skip 1
    + CategoryInfo          : ObjectNotFound: (C:\Documents an...miec\sheeta.c
   sv:String) [Get-Content], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetCo
   ntentCommand

Cannot index into a null array.
At line:1 char:56
+ $users =  Import-Csv dat03.csv -Header (gc sheeta.csv)[ <<<< 0].trim(",").spl
it(",") | select -skip 1
    + CategoryInfo          : InvalidOperation: (0:Int32) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

[PS] C:\Documents and Settings\admin.jamiec>foreach ($user in $users) {move-mail
box $user.DisplayName -targetDatabase $user.targetdatabase}
Move-Mailbox : Cannot bind argument to parameter 'TargetDatabase' because it is
 null.
At line:1 char:74
+ foreach ($user in $users) {move-mailbox $user.DisplayName -targetDatabase <<<
<  $user.targetdatabase}
    + CategoryInfo          : InvalidData: (:) [Move-Mailbox], ParameterBindin
   gValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,M
   icrosoft.Exchange.Management.RecipientTasks.MoveMailbox







dat03-csv-1-.xls
0
Comment
Question by:happyexchange
  • 4
  • 3
7 Comments
 
LVL 13

Accepted Solution

by:
soostibi earned 2000 total points
ID: 35419797
Please write the full path here:

 Import-Csv c:\yourpath\sheeta.csv

or set the location where the CSV file resides.

All other errors caused by this.
0
 

Author Comment

by:happyexchange
ID: 35419849
so leave out $users = import-csv

The csv file is saved as dat03.csv in my admin profile on the exchange. Does that matter
0
 
LVL 13

Expert Comment

by:soostibi
ID: 35419884
No, leave '$users = ' there, but extend the path to full path.
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

Author Comment

by:happyexchange
ID: 35419964
Sorry mate.

So c:\documentsand settings\adminjamiec

But when i open the exchange cmdlet that is aleady there.  it starts with C:\documentsand settings\adminjamiec\ then i put the script in.
0
 
LVL 13

Expert Comment

by:soostibi
ID: 35420048
Sorry, the the path is missing from here also:

(gc sheeta.csv)

Anyway, the file should be edited a bit: the empty lines should be deleted, and the one with some summary data in it should also be deleted.
And I also recommend to fill in all the headers in each column. If you do this, you can simplify the import to:

$users =  Import-Csv c:\yourfile\sheeta.csv
0
 

Author Comment

by:happyexchange
ID: 35420099
I have split the spreadsheet into 3 called dat01 + dat02 + dat03 and deleted any lines.

Sorry mate could you write the script so i would know what it is and do.

Thank you for everything

0
 
LVL 13

Expert Comment

by:soostibi
ID: 35422171
If you have 3 CSV files, no emptly lines, no summary, but a column header for every columns that have values and for all columns that are between columns that have values, then you can do the following:

$users =  @(Import-Csv c:\yourpath\sheeta.csv) + @(Import-Csv c:\yourpath\sheetb.csv) +@(Import-Csv c:\yourpath\sheetc.csv)
foreach ($user in $users) {move-mailbox $user.DisplayName -targetDatabase $user.targetdatabase}

0

Featured Post

Industry Leaders: 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

As much as Microsoft wants to kill off PST file support, just as they tried to do with public folders, there are still times when it is useful or downright necessary to export Exchange mailboxes to PST files. Thankfully, it is still possible to e…
If you have come across a situation where you need to find some EDB mailbox recovery techniques, then here you will find the same. In this article, we will take you through three techniques using which you will be able to perform EDB recovery. You …
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
This video discusses moving either the default database or any database to a new volume.
Suggested Courses

830 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