Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to import PST files at the console

PowerShell

How to import PST files at the console

by  markdmac  Posted    (Edited  )
Importing PST Files into Exchange 2010

Overall Process
1. Assign the management account the rights to import/export
2. Create the file share
3. Direct databases to use a specific server
4. Create the Import data request
5. Verify the Import data request
6. Direct databases to use the CAS Array

==========================================================================

First you have to assign rights to import using this PowerShell command:

New-ManagementRoleAssignment ûRole ôMailbox Import Exportö ûUser mmaclachlan

==========================================================================
Setup a file share

You need to setup a shared folder that will be accessible via a UNC path.
Local drives are not supported for the import operation.
I have setup a share on \\EXCH01\PSTFILES which is on the E drive

Note that at the Share level, Exchange Trusted System must have Read/Write permissions.

==========================================================================
If you have more than one Exchange server and have configured a CAS array, then you must set the databases to use a specific server instead of the CAS array

Get-MailboxDatabase | Set-MailboxDatabase -RpcClientAccessServer "exch01.company.local"

==========================================================================
To import a single PST use the following command:

New-MailboxImportRequest ûMailbox mmaclachlan ûFilePath \\EXCH01\PSTFiles\mmaclachlan.pst

Another way to do it is like this:
Get-Mailbox mark.maclachlan | NewMailboxImportRequest -FilePath \\EXCH01\PSTFiles\mark.maclachlan.pst

==========================================================================
To import a group of PST files use the following commands
(just copy and paste all lines directly into the shell):

Dir \\EXCH01\PSTFiles\*.pst | %{
New-MailboxImportRequest ûName ImportOfPst ûBatchName ImportPstFiles `
ûMailbox $_.BaseName ûFilePath $_.FullName
}


==========================================================================
To view the status of the import request run:

Get-MailboxImportRequest

==========================================================================
When the import request has been completed, you need to set the database back to the CAS Array. Do not set back until the request has completed. If you set it back while things are still queued you will get failures on the import.

Get-MailboxDatabase | Set-MailboxDatabase -RpcClientAccessServer "webmail.company.com"
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top