• 0

[Req] Batch Export PST's from Exchange 2010


Question

I have been exporting PST files for our company for terminated employees one by one and it takes a rather considerable amount of time to set each one up. Is there any method to just tell it to export from a list, or group?

 I am just trying to find a quicker way of exporting large groups of people.

 

I have been using the following command in powershell.

 

New-MailboxExportRequest -Mailbox username -FilePath "\\servername\Share\user.pst"

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

Which version of Exchange are you using?

 

you can use a for-each cycle and a CSV file to check each mailbox and export it to a network share or volume; the CSV file must have a Alias column and the mailbox alias you want to export.

foreach ($i in (Import-Csv .\maiboxes.csv)) { New-MailboxExportRequest -Mailbox $i.Alias -FilePath "\\servername\share\$($i.Alias).pst" }

or you can export all the mailboxes in a single OU:

foreach ($i in (Get-Mailbox -OrganizationalUnit Marketing)) { New-MailboxExportRequest -Mailbox $i -FilePath "\\servername\share\$($i.Alias).pst" }

The above exports all the users mails to a network share PST with the user alias as the name of the PST; it will fetch the users mailbox in the Marketing OU.

 

Remember that this is resources consuming task; it will make the server crawl if done careless!

 

Edit: use this to check for the status of the queue.

Get-MailboxExportRequest | Remove-MailboxExportRequest
Link to comment
Share on other sites

  • 0

i was hoping more for like a batch file or something. We wont be able to purchase something as they will just tell me to do it manually like i have been.

 

we just have a lot of turnover, so once a month or so i have to export a few hundred accounts.

Link to comment
Share on other sites

  • 0

"so once a month or so i have to export a few hundred accounts."

every month is a few hundred, yeah that's a bit of turnover ;)

If you have your command, just run it in a loop with an array of your names.

here this should help

http://powertoe.wordpress.com/2009/12/14/powershell-part-4-arrays-and-for-loops/

Link to comment
Share on other sites

  • 0

Well i just found this, but it keeps failing because its not naming the PST file at all, its just ".pst.pst"

 

$Export = Get-Content .\Mailbox.txt

 

$Export|%{$_|New-MailboxExportRequest -FilePath "\\servername\pst\$($_.alias).pst"} 

 

It will queue them up properly just it names the first file ".pst.pst" and then cannot create the remaining files because there is a duplicate name.

Link to comment
Share on other sites

  • 0

Ok,

 

For anyone in the future with this issue this is what i did

 

$Export = Get-Content .\Mailbox.txt

 

Contents of mailbox.txt

 

Username1

Username2

Username3

$Export|%{$_|New-MailboxExportRequest -FilePath "\\servername\pst\$($_).pst"} 

 

This created an export request for each user account in the list.

 

I would prefer to do it using the whole ou as it would be easier to manage (wouldn't have to create a list) but this worked for me.

Link to comment
Share on other sites

  • 0

Ok,

 

For anyone in the future with this issue this is what i did

 

$Export = Get-Content .\Mailbox.txt

$Export|%{$_|New-MailboxExportRequest -FilePath "\\servername\pst\$($_).pst"} 

 

This created an export request for each user account in the list.

 

I would prefer to do it using the whole ou as it would be easier to manage (wouldn't have to create a list) but this worked for me.

 

did you see my post? It's the same but in a more elegant way :D

also you can use the Get-Mailbox -OrganizationalUnit to export a whole OU.

Link to comment
Share on other sites

  • 0

did you see my post? It's the same but in a more elegant way :D

also you can use the Get-Mailbox -OrganizationalUnit to export a whole OU.

Yes i saw it, not really a fan of using the foreach on the server though. But it did actually help me resolve my issue with how i was doing it. And i took the advice and created an OU of users to export rather than making a list. it helped out a lot.

Link to comment
Share on other sites

This topic is now closed to further replies.