Description

This script imports multiple PST files located in a single directory into a user mailbox or a user mailbox archive.

Due to some filename limitations of the New-MailboxImportRequest cmdlet in reagards to the UNC path, the PST filenames are sanitized. Any unsupported (unwanted) character is removed. You can modify the replacement function as needed. This might be necessary as the PST filenames can be used as target folder names during import.

Original filenames:

Renamed filenames:

When using the FilenameAsTargetFolder switch each PST file is imported into a separate target folder.

After successfully importing a PST file, the PST can optionally be renamed to .imported. This simplifies a re-run of the script in the case that you a lot of PST files for a user or a large number of files as part of archive solution offboarding process.

NOTE:
This script utilizes the GlobalFunctions PowerShell module for logging. Please prepare your system for the use of the GlobalFunctions module first.

Steps performed:

Sanitize PST filenames

Create new mailbox import request

Monitor status of created import request

When still running, continue monitoring status

When successfully finished, save import request statistics report to log file and continue with next PST