Scenario: You have a list of PST files that you want to import into a mailbox. You want to place the imports into a folder in the mailbox called ‘Imported’ so it doesn’t conflict with the users current mailbox folder structure.
Here is what you have:
- A list of users in .csv format with the csv header of NAME
- The PST files located in a directory (or multiple sub directories) with the users name in the PST files.
- Exchange Powershell!
Script: The script below will take the list of users in the csv format, loop through each user to find their PST’s. For each PST it will create a New Mailbox Import Request. Note – Make sure your properly plan space as you could potentially blow up your database/log size.
#Import the users from the CSV File $users = Import-csv C:tempusers.csv #Loop through each user $users | %{ $u = $_ | Select -ExpandProperty Name #Find the PST files for the user in this loop $files = get-childitem \FileServer1SharePSTs -file $u* -Recurse #For each PST file, Create a Mailbox Import Request $files.fullname | %{ New-mailboximportrequest $u -filepath $_ -acceptlargedataloss -baditemlimit 100000 -batchname BigImport -targetrootfolder Unarchived } }