Export-Mailbox to PST from a list

Microsoft Windows server 2008 standard -...
May 19, 2010 at 05:05:49
Specs: Windows Server 2008
I need some help again, but this time, is to export mailboxes to pst folders from a given list (file.csv) of users instead of MDB. Here is what I did in a batch file which can not be interpreted in Powershell

@echo off & setlocal
for /f "tokens=*" %%a in (file.csv) do (
Get-Mailbox -(file.cvs)| Import-Mailbox -PSTFolderPath D:\PSTs

The following is the powershell command that will export users' mailbox from a specified Exchange07 MDB.

Get-Mailbox -Database 'MDB' | Import-Mailbox -PSTFolderPath D:\PSTs
How can I call dos batch file in Power shell or otherway around.

See More: Export-Mailbox to PST from a list

Report •

May 19, 2010 at 07:58:07
Not sure what you are asking? You just simply type the name of the file and it runs. Can you be more specific as to what your issue is?

Report •

May 19, 2010 at 09:24:53
ace_omega Not sure what you are asking
He's asking how you can mix batch script commands and power shell script commands into the same script. The answer is he can't.

Pick a language and stick to it. In this case, probably POWERSHELL! Assuming your csv is a list of mailboxes, split by new lines:

Get-Content file.csv | ForEach-Object {Get-Mailbox -Database $_ | Import-Mailbox -PSTFolderPath D:\PSTs}

Report •

May 20, 2010 at 07:28:58
Thanks you Razor3.2,

The part of the script that I could not understand is the (-Database $_). I have four DataBases in two Servers and their paths are:

ServerA\f:SG01 Database\MD-AJ.edb
ServerA\f:SG01 Database\MD-AJ.edb
ServerB\f:SG01 Database\DIR.edb
ServerB\f:SG01 Database\ORG.edb

The users on the list (file.csv) to export their mailboxes to PST spread across these four databases

Thanks for your help, but please ignore this if this is too much a task, I will result doing it one line a time. Thanks

Report •

Related Solutions

May 24, 2010 at 06:43:01
Well, anything I type will be untested, as I do not have Exchange. Also, I still don't know the layout of your .CSV, nor how that would relate to the command you provided in your original post.

Report •

May 25, 2010 at 23:07:41
Thanks. My csv is one per line containing usernames = first.last
and saved as list.csv or list.txt

What I resulted doing is to copy a text file like the following and paste them on Powershell.

Export-Mailbox –Identity Dale.Peter -PstFolderpath \\ServerB\archives$\Users\PSTs
Export-Mailbox –Identity Frank.James -PstFolderpath \\ServerB\archives$\Users\PSTs
Export-Mailbox –Identity Russell.John -PstFolderpath \\ServerB\archives$\Users\PSTs

That is a long process to go through 240 users. And the result was not satisfactory, because some of the mailbox was not copied correctly. Instead what was copied was the default 256k pst.

I hope this will make it clear.

Report •

Ask Question