[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Automating backup of PST files to server

Posted on 2007-10-02
Medium Priority
Last Modified: 2010-04-08
I'm trying to figure out a way to automatically back up a user's PST file to his or her home folder on the server when he or she logs off the network.  

Can this be done using VBScript?
Question by:mjbtec
  • 3
LVL 12

Expert Comment

ID: 20002032
Easier than that !
You can create a batch file that will copy the pst to the desired location (it is better to map the network drive if possible). (use the old ods copy or xcopy function).
The using the scheduler (start > all programs > accessories > system tools > task sceduler) you can run your batch at desired time ...
LVL 12

Expert Comment

ID: 20002061
Hi again,
the batch would look like something like this :

@echo off

copy c:\[your path to pst file] g:\path to the destination /v

LVL 12

Expert Comment

ID: 20002102
Hi (again ...)
I didn't notice that you want this script to be run on logoff. It is easy to make it run on startup if you put the batch or a shortcut of the batch in the windows startup.
If you want to have it run at logoff you can setup up a gpo (go to run and type gpedit.msc then in the console go to User Configuration\Administrative Templates\System\Logon/Logoff)
LVL 10

Accepted Solution

ngravatt earned 2000 total points
ID: 20002460
use this application:


you can set it up so it backs up every time a user closes outlook.

Author Comment

ID: 20016897
I'll go with ngravatt's suggestion.

I did manage to make some scripts that back up the Outlook data to the server. I post them here.

Here's the VB Script version that detects the user name and copies all the PST files to the home folder.

Option Explicit
Dim objNetwork, objShell
Dim strDriveLetter, strUserName, strOutPath, strHome, strCom

Set objNetwork = WScript.CreateObject("WScript.Network")
strUserName = objNetwork.UserName
strOutPath="C:\Documents and Settings\" & strUserName & "\Local Settings\Application Data\Microsoft\Outlook\*.pst"
strHome= "\\server3\d$\home_folders\" & strUserName
strCom= "copy " & chr(34) & strOutPath & chr(34) & chr(32) & strHome

Set objShell = WScript.CreateObject("Wscript.Shell")
objShell.Run("%comspec% /c " & strCom)

I also made a version for AutoIt that's shorter but works just as well. AutoIt is a freeware scripting language that uses a BASIC-like language. It can be downloaded from http://www.autoitscript.com

$datapath ="C:\Documents and Settings\" & @UserName & "\Local Settings\Application Data\Microsoft\Outlook"
$copyto="\\server3\d$\home_folders\" & @UserName
FileCopy ($datapath & "\*.pst", $copyto,1)
FileOpenDialog ("PST Copy", "\\lrecdops-dc3\d$\home_folders\" & @UserName, "PST files (*.pst)")

I'll play with these scripts and see which works the best.

Thanks everyone for their help.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With so many activities to perform, Exchange administrators are always busy in organizations. If everything, including Exchange Servers, Outlook clients, and Office 365 accounts work without any issues, they can sit and relax. But unfortunately, it…
There can be many situations demanding the conversion of Outlook OST files to PST format and as such, there is no shortage of automated tools to perform this conversion. However, what makes Stellar OST to PST converter stand above the rest? Let us e…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question