How to Import PST Files to Office 365 with PowerShell?
Step-by-Step free process to import PST files to Office 365 with PowerShell.
A PST (Personal Storage Table) file is a local Outlook file which contains copies of emails, contacts, calendars, tasks, and other mailbox items. Organizations can have terabytes of PST files on their file servers, old laptops, and external drives.
When moving to Office 365, Microsoft recommends consolidating all this data of PST files to Exchange Online mailboxes. It makes all that data searchable, accessible, and compliant from anywhere. And it even eliminates risks [corruption, data loss, and other security problems] from PST files.
You can import PST files to Office 365 with PowerShell, Microsoft Purview compliance portal, and the AzCopy command line tool using the native Network Upload method.
In this blog, we will focus on importing PST files to Office 365 with PowerShell only. Let us get started!!
Prerequisites for PST to Office 365 Migration with PowerShell
Before you start, make sure you have the following:
Permissions
You must be a Global Administrator or you are assigned the Organization Management role group.
You must have access to generate a Shared Access Signature (SAS) URL from the Microsoft Purview compliance portal.
You need the Mailbox Import Export role assigned.
Requirements
You will need to download and install the latest version of the Microsoft AzCopy command-line tool.
PST file should ideally be less than 20GB for stable upload. Larger files have high failure rates.
Every PST file must have a unique file name to avoid conflicts in Azure storage blob containers.
Preparations
Collect all PST files in a central location.
Create a list of PST files mapped to their target user mailboxes.
Make sure target mailboxes in Office 365 have enough storage quota and licenses.
Windows PowerShell must be installed with administrative privileges along with the Exchange Online PowerShell V3 module.
Import PST Files to Office 365 with PowerShell - How to Do It?
Here is the detailed step-by-step process to import PST files to Office 365 with PowerShell command line. Follow the steps carefully for hassle-free results:
Step 1. Assign the Mailbox Import Export Role
Before you start, you must grant necessary administrator account permissions. By default, only Global Administrator is assigned this role, not the other groups.
Open PowerShell as administrator and connect to the Exchange Online with the below command:
Connect-ExchangeOnline
Moving ahead, assign the Mailbox Import Export role to Organization management role group using the below command:
New-ManagementRoleAssignment -Role "Mailbox Import Export" -SecurityGroup "Organization Management" -Name "Import Export Org Management"
Step 2. Create PST Import Job & Get SAS URL
Go to the Microsoft Purview compliance portal and sign in using your admin credentials.
Then, go to Solutions >Data Lifecycle Management >Import >New Import Job.
Type a name for the job and click Next.
Choose Upload your data and click Next.
On the Import data page, click Show network upload SAS URL. Copy the SAR URL displayed.
Click Download Azure AzCopy. A pop-up window will appear on your screen, click RUN to install AzCopy.
Note: Once you have downloaded the Azure AzCopy tool, make sure to click on the Cancel button to move to the next step.
Step 3. Upload PST Using AzCopy Utility
Open the Command Prompt as an administrator, navigate to the AzCopy tool location, and run:
azcopy.exe copy “<Source location of PST files>” “<SAS URL>”
This command displays the PST file import process status. Later, a final status message will display the total number of files uploaded to Azure storage location.
Step 4. Create PST Import Mapping File (CSV)
Microsoft uses a CSV file to determine which PST file should be imported to which mailbox and where.
Create a CSV with 10 columns, that includes Workload, FilePath, Name, Mailbox, IsArchive, TargetRootFolder, ContentCodePage, SPFileContainer, SPManifestContainer, and SPSiteUrl.
Step 5. Create PST Import Job in Compliance Center
Once the upload is completed and the mapping file is ready, you need to create a PST import job in Office 365.
Go to the Import data window in Microsoft Purview portal, select I’m done uploading my files and I have access to the mapping file and click Next.
Click Select mapping file and upload CSV file you created earlier.
Once uploaded, click on Validate, then Save >Close.
A new window will pop up on your screen displaying Analysis in Progress, and the New job will be displayed in the transferred page list.
Click Refresh to check updated status.
Wait for the analysis to complete and the status to turn to Analysis Completed.
Step 6. Filter & Start the Import to Office 365 Process
After you have created the job:
Go to the Import Jobs page and click on your job, then tap on Ready to Import to Office 365.
On the next screen, click Import to Office 365.
The ‘Filter your data’ window will appear on your screen, you can either select Yes, I want to filter it before importing or No, I want to import everything.
Make your selection and click Next.
Note: If you choose to import entire data, then click Import Data to begin the process. Wait till the status changes to Completed.
In this way, all your PST file data is imported to Office 365 with PowerShell.
Ending Note
Importing PST to Office 365 with PowerShell via Network Upload is Microsoft’s official and free way to consolidate PST data. For best results, always start with a small batch of 2-3 PSTs, validate the import process, and then proceed to bulk Import PST to Office 365 with ease.
About the Creator
Layla Darzi
I’m Layla, a content writer dedicated to creating meaningful, engaging, and results-driven content. I specialize in writing blogs, articles, website copy, and brand stories that blend creativity with strategy.
Enjoyed the story? Support the Creator.
Subscribe for free to receive all their stories in your feed.
Comments
There are no comments for this story
Be the first to respond and start the conversation.