Thursday, 13 March 2008

Exchange 2007 Powershell Export - Import PST Files

Export/Import to PST Requirements

In order to export or import mailboxes to PST files the following requirements must be met:

1) Export/Import to PST must be run from a 32 bit client machine with Exchange Management Tools installed (Version Exchange 2007 SP1 or later). The 32bit requirement comes from a dependency with the Outlook client.
2) Either Outlook 2003 or Outlook 2007 must be installed on the client machine.
3) The user running the task must be an Exchange Organization Admin or an Exchange Server Admin on the server where the mailbox to export/import lives.



Export a mailbox to a PST File
Export-Mailbox -Identity ALIAS -PSTFolderpath C:\

This will export a PST file to the path specified and name that pst as the alias

Import is much the same
Import-Mailbox -Identity ALIAS -PSTFolderpath C:\




To export all mailboxes to pst files the following commands are used
Get-Mailbox -Database MYDB Export-Mailbox -PSTFolderPath D:\PSTs


Mailboxes can also be exported to PST files via a scheduled task.

Running a scheduled task is a two step process:
1) Create the powershell script and save it as a .ps1 file.
get-mailbox export-mailbox -PSTFolderPath C:\ -Confirm:$false
1b) OR
get-mailbox -server exchangemail -resultsize unlimited export-mailbox -pstfolderpath Z:\ -baditemlimit 1000 -maxthreads 15 -confirm:$false

2) Create the scheduled task to run powershell and load the exchange snappin; then run your script. The action of your scheduled task should look like:
powershell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\Bin\ExShell.psc1" -Command ". 'C:\script.ps1'"

A common Exchange Administrator task for might also be the extraction into a PST from a mailbox that is a Recovery Storage Group (RSG) for legal or compliance.
Exporting content directly from a RSG database to a PST file is not supported. To accomplish this task you'd have to first restore the mailbox content to an online mailbox using restore-mailbox and then export the online mailbox to a PST.
You could for example create a new mailbox to hold the recovered content and only grant access to it to the legal department; then export its contents to a PST file. To restore an RSG mailbox to a "different" mailbox you only need to use two additional parameters:

Restore-Mailbox -Identity legalDepartmentMailbox -RSGDatabase "Recovery Storage Group\My Database" -RSGMailbox mailboxToRecover -TargetFolder "Recovered Content"

4 comments:

Alex said...

Advise good tool-pst recovery,recovering lost Microsoft Outlook data is a sequence of operations involving scanning, identifying and saving such Microsoft Outlook items as messages, contacts, notes, reminders, journals, meetings, etc,scans, identifies and saves data from the pst file without modifying or indexing the source pst file.

Alex said...

I had this problem two years ago and for me advised one tool-microsoft outlook pst recover program,it can to do other operations,also softare has free status as far as I can see,utility can preview analysis results and make a decision, which messages should be extracted,it has two ways to recover your data: you can convert corrupted mailbox to another mailbox in *.pst format, it can be opened by any email client, compatible with Microsoft Outlook,compatible with all supported versions of Windows operating system, starting from Windows 98,can extract all files separately: *.eml, *.txt and *.vcf documents will be placed to any folder upon your choice.

Alex said...

Today I downloaded one tool from net-how to import an .ost file to the ms outlook?.I was very lucky,tool recovered some of my old mails in 30 seconds and for free.Moreover I saw how it can read *.ost files and extract your mails, contacts, tasks and calendars.

Annie said...

When conversing about PST files, i just think about very useful pst recovery software, which i used when i lost my PST data. Process contains so many difficulties that a typical individual may accidentally commit severe blunders. Only when the individual has misplaced his valuable files, he may realize the value of PST recovery software. Anyway many thanks for this piece of article.