I was listening to the latest episode of the Casting from the Server Room podcast this morning, and one of the discussions was about backing up an Outlook .pst when users leave Outlook open overnight, which is when the backup is scheduled to run.

In order to back an Outlook .pst file, the .pst file must not be in use.  The easiest way to make sure the .pst file isn’t in use is to close Outlook on the computer the .pst resides on.

Table of Contents

    I found this .vbs script, written by Bill Stewart, on Chris’s blog that will close Outlook gracefully.

    On Error Resume Next
     Set Outlook = GetObject(, "Outlook.Application")
     If Err = 0 Then
     Outlook.Quit()
     End If
    

    Just killing Outlook can result in .pst corruption, so I don’t suggest using a program like pskill to terminate outlook.exe.

    Bill also has an Exchange version of the above script, which can be downloaded here.

    You can schedule these scripts to run nightly with a Windows Scheduled Task, or with a program like psexec, which will execute programs on remote machines through a command line or script.

    Leave a Reply

    Your email address will not be published. Required fields are marked *