To convert OST to PST using a PowerShell Script, you must automate Microsoft Outlook because the OST format can only be accessed through Outlook’s MAPI interface. PowerShell will control Outlook to create a PST and copy mailbox folders into it.
Steps to convert the OST file to PST with PowerShell
Step 1 Open PowerShell
- Press Start
- Search PowerShell
- Click Run as Administrator
Step 2 Create the PowerShell script
Copy the following script and save it as:
# Start Outlook
$outlook = New-Object -ComObject Outlook.Application
$namespace = $outlook.GetNamespace("MAPI")
$namespace.Logon()
# PST file path
$pstPath = "C:\Temp\export.pst"
# Create PST store
$namespace.AddStore($pstPath)
# Get mailbox
$mailbox = $namespace.Folders.Item(1)
# Get new PST folder
$pstStore = $namespace.Folders | Where-Object {
$_.Store.FilePath -eq $pstPath
}
# Copy folders
foreach ($folder in $mailbox.Folders) {
$folder.CopyTo($pstStore)
}
Write-Host "OST exported to PST successfully"
Step 3 Allow script execution
Run Command
Set-ExecutionPolicy RemoteSigned
Step 4 Run the script
Now, navigate to the folder with script
cd C:\Scripts
.\convert-ost-pst.ps1
Step 5: Locate PST file
C:\Temp\export.pst
With the following this steps you can convert OST files to PST with PowerShell Script. But if the OST files is orphaned, inaccessible, corrupted, you utilize dedicated tools like Softaken OST to PST Converter Software.
With the use of this application you can easily convert OST files.
Steps
- Install and Run
- Browse and Add OST file
- Take Preview of OST file
- Choose PST file format
- Select desired location
- Start convert process
I hope you learn how to convert OST to PST with PowerShell.