Script to schedule your pst-file back-up

This pst-file backup script is a really easy to use script for which no coding skills are required.

This guide shows you how to configure the script to back up your pst-files to a location of choice. It supports an unlimited amount of pst-files and even network locations are supported as the backup location.

Optionally, you can keep a backup archive and have the script start Outlook again once it is done so it almost goes unnoticed.

Once configured, you can use the script on-demand by a simple double click but you can also fully automate your backups by using it with a Scheduled Task. Step-by-step instructions are provided for how to set it up.


Download the backup script

backupoutlook.vbs buttonDownload: Backup Outlook script

After downloading the zip-file, you’ll need to extract it. To do this, right click on the zip-file and choose: Extract All…

Don’t execute the included backupoutlook.vbs file before configuring it!

Once you have configured it, you can execute it manually by double clicking on it, or create a Scheduled Task to backup your pst-files automatically on a regular basis.

Configure the backup script

backupoutlook.vbs buttonThere are a couple of things you must configure and a couple of things you can configure before using the script for the first time.

To configure the script, right click on the extracted backupoutlook.vbs file and choose Edit. The script will then open in Notepad or another script editor you have configured for vbs-files.

Must configure:

  • The amount of pst-files to back up.
    The ReDIM pst(1) part of the script sets how many pst-files you want to back up. As this is an array, the counting starts at 0 and not 1. So ReDim pst(1) means you have 2 pst-files defined in the script to backup. If you only want to backup 1 pst-file, you must change this to ReDim pst(0).
  • The location of each pst-file to back up.
    Define the location for each pst-file that you want to back up. Make sure you increase the counter for pst(0) = for each pst-file and that the path is enclosed in double straight quotes.
  • The backup location for your pst-files.
    Specify the folder to which you want to make your backups. If this folder does not exist before running the script, the script tries to create it. Make sure that the path is enclosed in double straight quotes and ends with a slash (\). This path may also be a network path, either specified as an UNC path or a mapped network drive. Any existing pst-files with the same name that exist in the folder will be overwritten.

Optionally configure:

  • Delay to let Outlook close on its own.
    If Outlook is running, the script sends a Close command to Outlook and will wait for 30 seconds for Outlook to close on its own. If Outlook still didn’t closed by then, the script will kill the outlook.exe process to be able to continue with the backup. Depending on your Outlook version and the amount of add-in that you have, the delay can be shortened or needs to be extended. This value is set in milliseconds. 30000 milliseconds will suit most environments though.
  • Whether or not to keep a history of your backups.
    To keep old backups, you can enable KeepHistory. The script will then create a subfolder with a date reference within the backup path.
  • Restart Outlook after completion.
    As you may be having Outlook open all the time, you can set the script to start Outlook again as soon as it is done. You then don’t have to wait impatiently for the backup to finish and fire up Outlook again manually ;-)

Create a Scheduled Task to backup your pst-files

Task Scheduler buttonTo automate you backups, you can create a Scheduled Task to execute this script automatically on a regular interval. In the example below, we’ll configure it to backup each day a 6PM (18:00).

  1. Open the Task Scheduler applet. You can locate it in one of the following ways:
    • Open the Control Panel from the Start Menu and in the Search box at the top right in Control Panel type: schedule tasks
    • Type schedule tasks in the Search box of the Start Menu (or in Windows 8, just start typing when you open the Start Screen)
    • Type taskschd.msc in the Search box of the Start Menu, Start Screen or Control Panel or in a Run command.
  2. From the Action pane on the right side of the Task Scheduler window click:
    Create Task…
  3. On the General tab fill in the following fields;
    • Name: Backup Outlook
    • Description: This task backs up Outlook pst-files on a daily basis
  4. Select the Triggers tab and press New….
  5. From the New Trigger dialog that pops-up set the following options;
    • Begin the task: On a schedule
    • Settings: Daily
    • Start: <today’s date> 6:00:00 PM (18:00:00)
    • Synchronize across time zones: Enabled.
      This prevents the backup from running during the day while you are still working or at night when your computer/laptop is off when you are in a different time zone.
    • Enabled: selected
  6. Press OK to close the New Trigger dialog.
  7. Select the Actions tab and press New…
  8. Use the Browse… button to browse to the location of your configured backupoutlook.vbs file.
    • Tip: You may want to store this file in a location where it is convenient and won’t get moved by mistake. For instance, create a folder C:\TASKS or C:\SCRIPTS.
  9. Press OK to close the New Action dialog. 
  10. Optionally: On the Conditions tab, you can set the option to wake the computer to run the task. Also, if you have set it to back up to a network share, you can set a the condition that a specific network connections should be available before executing the task.

Fully automate your pst-file backups by using a Scheduled Task and our backup script. (Click the image to enlarge)
Fully automate your pst-file backups by using a Scheduled Task and our backup script.
(Click the image to enlarge)

Deleting the task
If you ever want to delete the task again, you can do so by opening Task Scheduler again. On the left side, select the Task Scheduler Library and you’ll find the task back in the center pane at the top. Right click the task and choose “Delete”.

VBS Code for Reference

The following code is contained in the zip-file referenced in the download section. You can use the code below for review or copy it and save it in a vbs-file yourself.


Click in the area above and press CTR+A to select all. Press CTRL+C to copy the code.