Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Exchange 2007: cross org mailbox migration bulk from csv file

Reply
 
Old 01-09-2008   #1 (permalink)
selspiero


 
 

Exchange 2007: cross org mailbox migration bulk from csv file

Hi all

I am trying to migrate Exchange 2003 mailboxes in one forest, to
exchange 2007 in another forest.

I can do it with the following script:

get-mailbox -domaincontroller 'sourceDC' -credential $s -identity
'name@xxxxxx' | move-mailbox -Targetdatabase 'EX2007\mailbox
database' -sourceforestglobalcatalog 'sourceGC' -globalcatalog
'targetGC' -domaincontroller 'targetDC' -sourcemailboxcleanupoptions
none -SourceForestCredential $s-targetforestcredential $t -confirm:
$false

This script works correctly for single mailboxes.

What i need to do now, is get the -identity command to read from
either a .csv file or a .txt file (Whichever is easier) so that i can
migrate mailboxes in batches.

i would also like to wrap it up into a .ps1 script

Could someone help me?

Cheers

Ian

My System SpecsSystem Spec
Old 01-09-2008   #2 (permalink)
Shay Levi


 
 

Re: Exchange 2007: cross org mailbox migration bulk from csv file

Create a CSV file with one column named "Identity" and add the names one
per line.

Import-Csv automatically creates an object with properties that corresponds
to the names of the columns.
That way you can remove the -identity paramater from the command cause it's
going to be piped
to get-mailbox from Import-Csv.


import-csv names.csv | get-mailbox -domaincontroller 'sourceDC' -credential
$s | move-mailbox -Targetdatabase .....


See Recipe 2.5 from "Windows PowerShell Cookbook" by Lee Holmes.
http://www.oreilly.com/catalog/9780596528492/index.html



-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic


Quote:

> Hi all
>
> I am trying to migrate Exchange 2003 mailboxes in one forest, to
> exchange 2007 in another forest.
>
> I can do it with the following script:
>
> get-mailbox -domaincontroller 'sourceDC' -credential $s -identity
> 'name@xxxxxx' | move-mailbox -Targetdatabase 'EX2007\mailbox
> database' -sourceforestglobalcatalog 'sourceGC' -globalcatalog
> 'targetGC' -domaincontroller 'targetDC' -sourcemailboxcleanupoptions
> none -SourceForestCredential $s-targetforestcredential $t -confirm:
> $false
>
> This script works correctly for single mailboxes.
>
> What i need to do now, is get the -identity command to read from
> either a .csv file or a .txt file (Whichever is easier) so that i can
> migrate mailboxes in batches.
>
> i would also like to wrap it up into a .ps1 script
>
> Could someone help me?
>
> Cheers
>
> Ian
>

My System SpecsSystem Spec
Old 01-09-2008   #3 (permalink)
Shay Levi


 
 

Re: Exchange 2007: cross org mailbox migration bulk from csv file

BEWARE, always add the -whatif parameter before applying it in production!

Good Luck.

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic


Quote:

> On Jan 9, 12:54 pm, Shay Levi <n...@xxxxxx> wrote:
>
Quote:

>> Create a CSV file with one column named "Identity" and add the names
>> one per line.
>>
>> Import-Csv automatically creates an object with properties that
>> corresponds
>> to the names of the columns.
>> That way you can remove the -identity paramater from the command
>> cause it's
>> going to be piped
>> to get-mailbox from Import-Csv.
>> import-csv names.csv | get-mailbox -domaincontroller 'sourceDC'
>> -credential $s | move-mailbox -Targetdatabase .....
>>
>> See Recipe 2.5 from "Windows PowerShell Cookbook" by Lee
>> Holmes.http://www.oreilly.com/catalog/9780596528492/index.html
>>
>> -----
>> Shay Levi
>> $cript Fanatichttp://scriptolog.blogspot.com
>> Hebrew weblog:http://blogs.microsoft.co.il/blogs/scriptfanatic
Quote:

>>> Hi all
>>>
>>> I am trying to migrate Exchange 2003 mailboxes in one forest, to
>>> exchange 2007 in another forest.
>>>
>>> I can do it with the following script:
>>>
>>> get-mailbox -domaincontroller 'sourceDC' -credential $s -identity
>>> 'n...@xxxxxx' | move-mailbox -Targetdatabase 'EX2007\mailbox
>>> database' -sourceforestglobalcatalog 'sourceGC' -globalcatalog
>>> 'targetGC' -domaincontroller 'targetDC' -sourcemailboxcleanupoptions
>>> none -SourceForestCredential $s-targetforestcredential $t -confirm:
>>> $false
>>>
>>> This script works correctly for single mailboxes.
>>>
>>> What i need to do now, is get the -identity command to read from
>>> either a .csv file or a .txt file (Whichever is easier) so that i
>>> can migrate mailboxes in batches.
>>>
>>> i would also like to wrap it up into a .ps1 script
>>>
>>> Could someone help me?
>>>
>>> Cheers
>>>
>>> Ian- Hide quoted text -
>>>
>> - Show quoted text -
>>
> Thanks mate, i will try that now
>
> Cheers
>
> E
>

My System SpecsSystem Spec
Old 01-09-2008   #4 (permalink)
selspiero


 
 

Re: Exchange 2007: cross org mailbox migration bulk from csv file

On Jan 9, 12:54*pm, Shay Levi <n...@xxxxxx> wrote:
Quote:

> Create a CSV file with one column named "Identity" and add the names one
> per line.
>
> Import-Csv automatically creates an object with properties that corresponds
> to the names of the columns.
> That way you can remove the -identity paramater from the command cause it's
> going to be piped
> to get-mailbox from Import-Csv.
>
> import-csv names.csv | get-mailbox -domaincontroller 'sourceDC' -credential
> $s | move-mailbox -Targetdatabase .....
>
> See Recipe 2.5 from "Windows PowerShell Cookbook" by Lee Holmes.http://www..oreilly.com/catalog/9780...492/index.html
>
> -----
> Shay Levi
> $cript Fanatichttp://scriptolog.blogspot.com
> Hebrew weblog:http://blogs.microsoft.co.il/blogs/scriptfanatic
>
>
>
Quote:

> > Hi all
>
Quote:

> > I am trying to migrate Exchange 2003 mailboxes in one forest, to
> > exchange 2007 in another forest.
>
Quote:

> > I can do it with the following script:
>
Quote:

> > get-mailbox -domaincontroller 'sourceDC' -credential $s -identity
> > 'n...@xxxxxx' | move-mailbox -Targetdatabase 'EX2007\mailbox
> > database' -sourceforestglobalcatalog 'sourceGC' -globalcatalog
> > 'targetGC' -domaincontroller 'targetDC' -sourcemailboxcleanupoptions
> > none -SourceForestCredential $s-targetforestcredential $t -confirm:
> > $false
>
Quote:

> > This script works correctly for single mailboxes.
>
Quote:

> > What i need to do now, is get the -identity command to read from
> > either a .csv file or a .txt file (Whichever is easier) so that i can
> > migrate mailboxes in batches.
>
Quote:

> > i would also like to wrap it up into a .ps1 script
>
Quote:

> > Could someone help me?
>
Quote:

> > Cheers
>
Quote:

> > Ian- Hide quoted text -
>
> - Show quoted text -
Thanks mate, i will try that now

Cheers

E
My System SpecsSystem Spec
Old 01-09-2008   #5 (permalink)
selspiero


 
 

Re: Exchange 2007: cross org mailbox migration bulk from csv file

On Jan 9, 12:54*pm, Shay Levi <n...@xxxxxx> wrote:
Quote:

> Create a CSV file with one column named "Identity" and add the names one
> per line.
>
> Import-Csv automatically creates an object with properties that corresponds
> to the names of the columns.
> That way you can remove the -identity paramater from the command cause it's
> going to be piped
> to get-mailbox from Import-Csv.
>
> import-csv names.csv | get-mailbox -domaincontroller 'sourceDC' -credential
> $s | move-mailbox -Targetdatabase .....
>
> See Recipe 2.5 from "Windows PowerShell Cookbook" by Lee Holmes.http://www..oreilly.com/catalog/9780...492/index.html
>
> -----
> Shay Levi
> $cript Fanatichttp://scriptolog.blogspot.com
> Hebrew weblog:http://blogs.microsoft.co.il/blogs/scriptfanatic
>
>
>
Quote:

> > Hi all
>
Quote:

> > I am trying to migrate Exchange 2003 mailboxes in one forest, to
> > exchange 2007 in another forest.
>
Quote:

> > I can do it with the following script:
>
Quote:

> > get-mailbox -domaincontroller 'sourceDC' -credential $s -identity
> > 'n...@xxxxxx' | move-mailbox -Targetdatabase 'EX2007\mailbox
> > database' -sourceforestglobalcatalog 'sourceGC' -globalcatalog
> > 'targetGC' -domaincontroller 'targetDC' -sourcemailboxcleanupoptions
> > none -SourceForestCredential $s-targetforestcredential $t -confirm:
> > $false
>
Quote:

> > This script works correctly for single mailboxes.
>
Quote:

> > What i need to do now, is get the -identity command to read from
> > either a .csv file or a .txt file (Whichever is easier) so that i can
> > migrate mailboxes in batches.
>
Quote:

> > i would also like to wrap it up into a .ps1 script
>
Quote:

> > Could someone help me?
>
Quote:

> > Cheers
>
Quote:

> > Ian- Hide quoted text -
>
> - Show quoted text -
hi again

thanks for that, i will work, i just have one other question...

in the source domain, i only have one 2003 DC, and if the script looks
at either of the other 2 2000 DCs, it fails. Could you look at my
script above and tell me where i can specify the 2003 DC?

Thanks again

Ian
My System SpecsSystem Spec
Old 01-09-2008   #6 (permalink)
Shay Levi


 
 

Re: Exchange 2007: cross org mailbox migration bulk from csv file

I can see that you already specified it, as in:

get-mailbox -domaincontroller 'sourceDC'...

or am I missing something?

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic


Quote:

> On Jan 9, 12:54 pm, Shay Levi <n...@xxxxxx> wrote:
>
Quote:

>> Create a CSV file with one column named "Identity" and add the names
>> one per line.
>>
>> Import-Csv automatically creates an object with properties that
>> corresponds
>> to the names of the columns.
>> That way you can remove the -identity paramater from the command
>> cause it's
>> going to be piped
>> to get-mailbox from Import-Csv.
>> import-csv names.csv | get-mailbox -domaincontroller 'sourceDC'
>> -credential $s | move-mailbox -Targetdatabase .....
>>
>> See Recipe 2.5 from "Windows PowerShell Cookbook" by Lee
>> Holmes.http://www.oreilly.com/catalog/9780596528492/index.html
>>
>> -----
>> Shay Levi
>> $cript Fanatichttp://scriptolog.blogspot.com
>> Hebrew weblog:http://blogs.microsoft.co.il/blogs/scriptfanatic
Quote:

>>> Hi all
>>>
>>> I am trying to migrate Exchange 2003 mailboxes in one forest, to
>>> exchange 2007 in another forest.
>>>
>>> I can do it with the following script:
>>>
>>> get-mailbox -domaincontroller 'sourceDC' -credential $s -identity
>>> 'n...@xxxxxx' | move-mailbox -Targetdatabase 'EX2007\mailbox
>>> database' -sourceforestglobalcatalog 'sourceGC' -globalcatalog
>>> 'targetGC' -domaincontroller 'targetDC' -sourcemailboxcleanupoptions
>>> none -SourceForestCredential $s-targetforestcredential $t -confirm:
>>> $false
>>>
>>> This script works correctly for single mailboxes.
>>>
>>> What i need to do now, is get the -identity command to read from
>>> either a .csv file or a .txt file (Whichever is easier) so that i
>>> can migrate mailboxes in batches.
>>>
>>> i would also like to wrap it up into a .ps1 script
>>>
>>> Could someone help me?
>>>
>>> Cheers
>>>
>>> Ian- Hide quoted text -
>>>
>> - Show quoted text -
>>
> hi again
>
> thanks for that, i will work, i just have one other question...
>
> in the source domain, i only have one 2003 DC, and if the script looks
> at either of the other 2 2000 DCs, it fails. Could you look at my
> script above and tell me where i can specify the 2003 DC?
>
> Thanks again
>
> Ian
>

My System SpecsSystem Spec
Old 01-09-2008   #7 (permalink)
selspiero


 
 

Re: Exchange 2007: cross org mailbox migration bulk from csv file

On Jan 9, 1:57*pm, Shay Levi <n...@xxxxxx> wrote:
Quote:

> I can see that you already specified it, as in:
>
> get-mailbox -domaincontroller 'sourceDC'...
>
> or am I missing something?
>
> -----
> Shay Levi
> $cript Fanatichttp://scriptolog.blogspot.com
> Hebrew weblog:http://blogs.microsoft.co.il/blogs/scriptfanatic
>
>
>
Quote:

> > On Jan 9, 12:54 pm, Shay Levi <n...@xxxxxx> wrote:
>
Quote:
Quote:

> >> Create a CSV file with one column named "Identity" and add the names
> >> one per line.
>
Quote:
Quote:

> >> Import-Csv automatically creates an object with properties that
> >> corresponds
> >> to the names of the columns.
> >> That way you can remove the -identity paramater from the command
> >> cause it's
> >> going to be piped
> >> to get-mailbox from Import-Csv.
> >> import-csv names.csv | get-mailbox -domaincontroller 'sourceDC'
> >> -credential $s | move-mailbox -Targetdatabase .....
>
Quote:
Quote:

> >> See Recipe 2.5 from "Windows PowerShell Cookbook" by Lee
> >> Holmes.http://www.oreilly.com/catalog/9780596528492/index.html
>
Quote:
Quote:

> >> -----
> >> Shay Levi
> >> $cript Fanatichttp://scriptolog.blogspot.com
> >> Hebrew weblog:http://blogs.microsoft.co.il/blogs/scriptfanatic
> >>> Hi all
>
Quote:
Quote:

> >>> I am trying to migrate Exchange 2003 mailboxes in one forest, to
> >>> exchange 2007 in another forest.
>
Quote:
Quote:

> >>> I can do it with the following script:
>
Quote:
Quote:

> >>> get-mailbox -domaincontroller 'sourceDC' -credential $s -identity
> >>> 'n...@xxxxxx' | move-mailbox -Targetdatabase 'EX2007\mailbox
> >>> database' -sourceforestglobalcatalog 'sourceGC' -globalcatalog
> >>> 'targetGC' -domaincontroller 'targetDC' -sourcemailboxcleanupoptions
> >>> none -SourceForestCredential $s-targetforestcredential $t -confirm:
> >>> $false
>
Quote:
Quote:

> >>> This script works correctly for single mailboxes.
>
Quote:
Quote:

> >>> What i need to do now, is get the -identity command to read from
> >>> either a .csv file or a .txt file (Whichever is easier) so that i
> >>> can migrate mailboxes in batches.
>
Quote:
Quote:

> >>> i would also like to wrap it up into a .ps1 script
>
Quote:
Quote:

> >>> Could someone help me?
>
Quote:
Quote:

> >>> Cheers
>
Quote:
Quote:

> >>> Ian- Hide quoted text -
>
Quote:
Quote:

> >> - Show quoted text -
>
Quote:

> > hi again
>
Quote:

> > thanks for that, i will work, i just have one other question...
>
Quote:

> > in the source domain, i only have one 2003 DC, and if the script looks
> > at either of the other 2 2000 DCs, it fails. Could you look at my
> > script above and tell me where i can specify the 2003 DC?
>
Quote:

> > Thanks again
>
Quote:

> > Ian- Hide quoted text -
>
> - Show quoted text -
no - thats what i thought - it is specified in the get-mailbox
command, but when i run my script it fails with the version needs to
be 5.2 or above error, then shows that the SourceDomainController it
tried to use was one of our 2000 ones... seems strange

cheers

E

My System SpecsSystem Spec
Old 01-09-2008   #8 (permalink)
Marco Shaw [MVP]


 
 

Re: Exchange 2007: cross org mailbox migration bulk from csv file

Quote:

>
> thanks for that, i will work, i just have one other question...
>
> in the source domain, i only have one 2003 DC, and if the script looks
> at either of the other 2 2000 DCs, it fails. Could you look at my
> script above and tell me where i can specify the 2003 DC?
>
> Thanks again
>
> Ian
Along the lines of the solution Shay posted, in your CSV, you'd need to
add perhaps another column named "domaincontroller", and have the proper
DC in the CSV file associated with each user.

Maco
My System SpecsSystem Spec
Old 01-09-2008   #9 (permalink)
Shay Levi


 
 

Re: Exchange 2007: cross org mailbox migration bulk from csv file

Can you tell which cmdlet is causing the error? get-mailbox or move-mailbox?
Can you post the error? replace the computer names if its confedential.

Another thing you can try, run the script on the 2003 DC without specifying
source DC parameters?


-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic


Quote:

> On Jan 9, 1:57 pm, Shay Levi <n...@xxxxxx> wrote:
>
Quote:

>> I can see that you already specified it, as in:
>>
>> get-mailbox -domaincontroller 'sourceDC'...
>>
>> or am I missing something?
>>
>> -----
>> Shay Levi
>> $cript Fanatichttp://scriptolog.blogspot.com
>> Hebrew weblog:http://blogs.microsoft.co.il/blogs/scriptfanatic
Quote:

>>> On Jan 9, 12:54 pm, Shay Levi <n...@xxxxxx> wrote:
>>>
>>>> Create a CSV file with one column named "Identity" and add the
>>>> names one per line.
>>>>
>>>> Import-Csv automatically creates an object with properties that
>>>> corresponds
>>>> to the names of the columns.
>>>> That way you can remove the -identity paramater from the command
>>>> cause it's
>>>> going to be piped
>>>> to get-mailbox from Import-Csv.
>>>> import-csv names.csv | get-mailbox -domaincontroller 'sourceDC'
>>>> -credential $s | move-mailbox -Targetdatabase .....
>>>> See Recipe 2.5 from "Windows PowerShell Cookbook" by Lee
>>>> Holmes.http://www.oreilly.com/catalog/9780596528492/index.html
>>>>
>>>> -----
>>>> Shay Levi
>>>> $cript Fanatichttp://scriptolog.blogspot.com
>>>> Hebrew weblog:http://blogs.microsoft.co.il/blogs/scriptfanatic
>>>>> Hi all
>>>>>
>>>>> I am trying to migrate Exchange 2003 mailboxes in one forest, to
>>>>> exchange 2007 in another forest.
>>>>>
>>>>> I can do it with the following script:
>>>>>
>>>>> get-mailbox -domaincontroller 'sourceDC' -credential $s -identity
>>>>> 'n...@xxxxxx' | move-mailbox -Targetdatabase 'EX2007\mailbox
>>>>> database' -sourceforestglobalcatalog 'sourceGC' -globalcatalog
>>>>> 'targetGC' -domaincontroller 'targetDC'
>>>>> -sourcemailboxcleanupoptions none -SourceForestCredential
>>>>> $s-targetforestcredential $t -confirm: $false
>>>>>
>>>>> This script works correctly for single mailboxes.
>>>>>
>>>>> What i need to do now, is get the -identity command to read from
>>>>> either a .csv file or a .txt file (Whichever is easier) so that i
>>>>> can migrate mailboxes in batches.
>>>>>
>>>>> i would also like to wrap it up into a .ps1 script
>>>>>
>>>>> Could someone help me?
>>>>>
>>>>> Cheers
>>>>>
>>>>> Ian- Hide quoted text -
>>>>>
>>>> - Show quoted text -
>>>>
>>> hi again
>>>
>>> thanks for that, i will work, i just have one other question...
>>>
>>> in the source domain, i only have one 2003 DC, and if the script
>>> looks at either of the other 2 2000 DCs, it fails. Could you look at
>>> my script above and tell me where i can specify the 2003 DC?
>>>
>>> Thanks again
>>>
>>> Ian- Hide quoted text -
>>>
>> - Show quoted text -
>>
> no - thats what i thought - it is specified in the get-mailbox
> command, but when i run my script it fails with the version needs to
> be 5.2 or above error, then shows that the SourceDomainController it
> tried to use was one of our 2000 ones... seems strange
>
> cheers
>
> E
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Exchange 2007 Remove Mailbox after AD deletion .NET General
Exchange 2007 - Mailbox management PowerShell
Re: Exchange 2007: cross org mailbox migration bulk from csv file PowerShell
Exchange 2007 Bulk Mailbox Creation - Password? PowerShell
Creating a new mailbox on Exchange 2007 PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46