Outlook PST Backup Script with 7-Zip

June 13, 2013

Office 2013 has been around for a little while now. If you happen to deal with people using PST files to store their emails, you probably noticed that good ol’ PFBackup from Microsoft is no longer working with this new updated Outlook.

After trying several applications and scripts, I concluded that I had to come up with a script of my own. I decided it was going to be simple, versatile and that it would compress the PST files with 7-Zip as an extra.

All you have to do is copy the code below inside a .BAT file and modify the destination paths on line 2 and 5 as you see fit. Install the resulting file on the user’s desktop and ask them to run it a few times a week in order to backup their emails. Outlook must be closed before running the script, obviously.
Del U:\BACKUP\MAIL\OutlookBackup.7z
for /f "delims=" %%a in ('dir /a-d /s /b *.pst') do ("%PROGRAMFILES%\7-Zip\7z.exe" u -mmt=on U:\BACKUP\MAIL\OutlookBackup.7z "%%a")
This script will scan your entire profile folder looking for *.PST files and have 7-Zip compress them inside one single archive.

Obviously, 7-Zip must be installed. Make sure there are no PST files with the same file name on the workstation, as it would result in an overwrite inside the archive. Just run the script once and look at the output.

Works with any version of Outlook, but won’t work with Exchange OST files.

No comments:

Post a Comment