exchange management shell - storage groups

Hi i have been using the script below to move the users (please see attachment) from one storage group to another

Import-Csv dat01.csv | foreach {move-mailbox $_.DisplayName -targetDatabase $_.targetdatabase}

Everytime i run this command in Exchange i keep getting this error message.  I know the ext is xls ut i have changed that to csv file on the exchange box.

Move-Mailbox : Cannot bind argument to parameter 'TargetDatabase' because it is
 null.
At line:1 char:76
+ Import-Csv Book1.csv | foreach {move-mailbox $_.DisplayName -targetDatabase <
<<<  $_.targetdatabase}
    + CategoryInfo          : InvalidData: (:) [Move-Mailbox], ParameterBindin
   gValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,M
   icrosoft.Exchange.Management.RecipientTasks.MoveMailbox

Please help  Thank you
dat01.csv.xls
happyexchangeAsked:
Who is Participating?
 
happyexchangeConnect With a Mentor Author Commented:
So something like this please see attachment

Then your script

Thank you
dat1.csv
0
 
Mkris9Commented:
Try this - Import-Csv dat01.csv | foreach {move-mailbox $_.DisplayName -targetDatabase "$_.targetdatabase"}

also please note that Database options normally needs to be in the format of  MailboxServer\StorageGroup\Database

for example   -TargetDatabase "MBX01\SG1\DB1"
0
 
Mkris9Commented:
also you have to columns with the name TargetDatabase
0
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

 
Mkris9Commented:
Yes - but best to use the target database in the format of "MBX01\SG1\DB1" rather than just the database name.
0
 
happyexchangeAuthor Commented:
All good
0
 
happyexchangeAuthor Commented:
Delete
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.