Solved

powershell create array move users different DB exchange

Posted on 2014-07-23
6
359 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
This article will help you understand what HashTables are and how to use them in PowerShell.
In this video we show how to create a User Mailbox 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 >> Mailb…
In this video we show how to create an email address policy 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…

758 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

18 Experts available now in Live!

Get 1:1 Help Now