Sunday, November 01, 2015

Automated compacting and copying of Microsoft Outlook PST files

Here's a way to automatically compact and backup all of your Microsoft Outlook PST data files on your Windows PC using only free software, AutoIT and PowerShell. AutoIT is freeware, and PowerShell is included in Microsoft Windows. Compacting your PST files before you back them up can reduce the amount of disk space required both at the source and destination locations of your backup.

So, to get started:

  1. Get the free AutoIT Full Installation and AutoIT Script Editor from the AutoIT Downloads page.
  2. Ensure PowerShell scripts that you create can run on your computer.
  3. Create an AutoIT script that, when the Mail control panel is open, will compact all PST files and then close the Mail control panel.
  4. Create a Powershell script that opens the Mail control panel and then executes the AutoIT script.

Here below are the AutoIT and Powershell scripts that I am running on my Windows 8.1 PC with Outlook 2013. I have a Windows Shortcut to my PowerShell script so that every time I log into my PC, my Outlook PST data files are compacted and backed up before Outlook is opened. I use the PowerShell script to also open other applications so that I may work on them while the Outlook PST data files are being backed up. Please feel free to copy the scripts below and modify them to work for you.

I am using Synology's Cloud Station to keep most of the data files on my laptop in sync with a Synology NAS, but Cloud Station doesn't work well with Outlook PST data files, which is why Cloud Station is configured by default to exclude the synchronization of files with a PST extension.

AutoIT script


PowerShell script