Solved

powershell create array move users different DB exchange

Posted on 2014-07-23
6
374 Views
Last Modified: 2014-08-21
I am trying to move users from one version 2007 to 2013 of Exchange to another. I am doing this from a migrationbatch. The problem is I am wanting them to spread across databases and heard I can do this with an array. I also honestly do not have a strong understanding of arrays. Can someone help me please. How would I incorporate an array into this command so that for each user in the csv file this can run and put them on different databases in the DAG, thanks

$dag2013_DBs = get-mailboxdatabase | where {$_.name –like “DAG2013*”}

New-MigrationBatch -Local -Name MigrationBatch1 -CSVData ([System.IO.File]::ReadAllBytes("E:\Migration\MigrationBatch1.csv")) -TargetDatabases $DAG2013_DBs –AutoStart –BadItemLimit  100 –AutoRetryCount 3  –NotificationEmails
0
Comment
Question by:techdrive
  • 2
  • 2
  • 2
6 Comments
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 40217311
Hello,

If you want to spread the mailboxes across your databases, just excluded the -TargetDatabases switch. Exchange will randomly distribute the mailboxes across the databases.

-JJ
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 40217315
An array is just a list of stuff. What the stuff actually is is entirely up to you. In this case you've potentially created an array of your mailbox databases.

However, the TargetDatabases parameter expects an array of strings, just database names. What you're giving it at the moment is a bit more complex than that. Are you finding it doesn't much like it?

If so, this should drop you down to just a name:
$dag2013_DBs = Get-MailboxDatabase | Where-Object { $_.Name -like  "DAG2013*" } | ForEach-Object { $_.Name }

Open in new window

It takes your current filtered list, and instead of holding onto everything it knows about the database it trims that down to just the database name (a string).

Given that I haven't used New-MigrationBatch (or Exchange 2013 for that matter) I can't comment too much on specific usage. Still, yell if it's not doing what you expect, I'm sure it can be encouraged :)

Chris
0
 

Author Comment

by:techdrive
ID: 40217569
thanks for the help but JJMCK but it is not distributing them evenly. Also thanks Chris Dent for your explanation as well.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 40217599
It randomly selects a database. The smaller the number of mailboxes you have, the less likely they will be evenly distributed. By using the -TargetDatabases switch it will also select randomly. It will just select from the list you provide instead of from all the available databases. If you want to evenly distribute the mailboxes, you will need to script that instead of using the New-MigrationBatch command.

-JJ
0
 

Author Comment

by:techdrive
ID: 40238095
I know exchange 2013 h capability to do this but I wanted to do this in powershell. Can anyone help?
0
 
LVL 70

Accepted Solution

by:
Chris Dent earned 500 total points
ID: 40238374
To balance the mailboxes across the stores?

You know you won't be able to use the batch migration tool?

And if you're balancing, what criteria? My last attempt doing this simply shoved new users in the smallest available store. I've yet to find a method that really stands the test of time.

Chris
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
In this video we show how to create a Contact 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 Recipients >> Contact ta…
To show how to create a transport rule 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 Mail Flow >> Rules tab.:  To cr…

813 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now