Outlook 2010 automatic backup

User avatar
Leif
Administrator
Posts: 7209
Joined: 15 Jan 2010, 22:52
Location: Middle of England

Outlook 2010 automatic backup

Post by Leif »

I know 2010 is probably getting long in the tooth, and this article is nearly two years old, but I only just came across it:

How to Automatically Backup Outlook 2010 .PST Files | HAI Tech Talk

This involves installing the Microsoft backup add-in for Outlook 2002-2007, then using Microsoft Fix It to get it to work...
Leif

User avatar
John Gray
PlatinumLounger
Posts: 5411
Joined: 24 Jan 2010, 08:33
Location: A cathedral city in England

Re: Outlook 2010 automatic backup

Post by John Gray »

Interesting.

I use a scheduled BATch file (every two hours, during the day) in which a program runs VSS to present the (originally "in use") Outlook PST file at a dummy drive letter, which I then backup using Robocopy.

If Outlook is not running, then Robocopy just runs to backup the PST file.

I've been doing this since the end of September 2011.
John Gray

"(or one of the team)" - how your hospital appointment letter indicates that you won't be seeing the Consultant...

Max
2StarLounger
Posts: 113
Joined: 23 Mar 2015, 22:28

Re: Outlook 2010 automatic backup

Post by Max »

Leif wrote:I know 2010 is probably getting long in the tooth, and this article is nearly two years old, but I only just came across it:

How to Automatically Backup Outlook 2010 .PST Files | HAI Tech Talk

This involves installing the Microsoft backup add-in for Outlook 2002-2007, then using Microsoft Fix It to get it to work...
I have just followed the steps above. It works ok. Thanks for that link.
Just two grumbles:
1. The option for frequency only goes down to every 1 day. It would be nice to have it set to hourly.
2. Because it is set to daily, each manually clicked Backup overwrites the previous entry for that day.

The second grumble concerns the fact that you have to exit Outlook for the Backup to take place. This is really annoying. It would have been nicer if Outlook could have Locked the PST for a few moments, then done the Backup and then un-locked Backup.

Still, a useful tool. Thanks
Max

User avatar
Leif
Administrator
Posts: 7209
Joined: 15 Jan 2010, 22:52
Location: Middle of England

Re: Outlook 2010 automatic backup

Post by Leif »

Max wrote: The second grumble concerns the fact that you have to exit Outlook for the Backup to take place. This is really annoying. It would have been nicer if Outlook could have Locked the PST for a few moments, then done the Backup and then un-locked Backup.
That's probably a bit like getting your local garage to service your car on a fixed regular basis, regardless of whether or not you happen to be driving it at the time.

Would you really want Outlook to freeze while you are in the middle of composing an email? I have a relatively large pst file and the backup takes more than five minutes. I certainly wouldn't want to be locked out mid-anything for that period of time!
Leif

Max
2StarLounger
Posts: 113
Joined: 23 Mar 2015, 22:28

Re: Outlook 2010 automatic backup

Post by Max »

Leif wrote: Would you really want Outlook to freeze while you are in the middle of composing an email? I have a relatively large pst file and the backup takes more than five minutes. I certainly wouldn't want to be locked out mid-anything for that period of time!
It is not like that. When you click on the Button to "Backup Now" is when it should happen. So, it is up to the user to decide when to do that. My point is that it should not be necessary to unload Outlook for that Backup to happen. Presumably, the user would not ask for a backup in the middle of composing/working on something.
Max

PJ_in_FL
5StarLounger
Posts: 1100
Joined: 21 Jan 2011, 16:51
Location: Florida

Re: Outlook 2010 automatic backup

Post by PJ_in_FL »

John Gray wrote:Interesting.

I use a scheduled BATch file (every two hours, during the day) in which a program runs VSS to present the (originally "in use") Outlook PST file at a dummy drive letter, which I then backup using Robocopy.

If Outlook is not running, then Robocopy just runs to backup the PST file.

I've been doing this since the end of September 2011.
John,

Very interesting way to get around the problems us "always on" folks have.

Would you mind sharing a generic version of your tech?
PJ in (usually sunny) FL

User avatar
John Gray
PlatinumLounger
Posts: 5411
Joined: 24 Jan 2010, 08:33
Location: A cathedral city in England

Re: Outlook 2010 automatic backup

Post by John Gray »

I use something called ShadowSpawn to do the VSS thing.
If you can read and appropriately amend BATch files, here's mine:

Code: Select all

@echo off

:: +---------+
:: I PSTcopy I  copy the main PST, perhaps using ShadowSpawn
:: +---------+    

::  this BATch file may be task scheduled at regular intervals,
::    and/or run as a Logoff script

:: it checks whether or not Outlook is running 
::    if Outlook IS started, it uses ShadowSpawn and thus VSS
::    if Outlook is NOT started, it doesn't need ShadowSpawn 
::      and the PST file is copyable without problems

:: we keep five backup copies of the PST file, suffixed  .#1 to .#5
::   the format is   BlueYonder account.pst.#1  up to  #5
::     the number has no function except to differentiate the filenames
::     for the latest copy, simply refer to the dates and times of the files

:: an interesting and unexpected side-effect is that if the PST file does 
::   NOT change between backups, then the same backup file number is used
:;   until there IS a change to the PST file!

setlocal

:: write a line to a log file each time a copy is done
set log=%~dp0Logs\%computername%_%~n0.log

:: source and target directories
set source=%UserProfile%\Documents\Outlook Files
set target=D:\Backup\%computername%\Outlook PSTs

:: set up the source file name, which will have .#n added for the target file name
set file=BlueYonder account.pst

:: get the current file size of the PST for the info message
for /f "tokens=3" %%a in ('dir "%source%\%file%" ^| find /i ".pst" ') do set pstsize=%%a

:: (alternative method, which omits the commas in the filesize...)
:: for %%a in (%file%) do set pstsize=%%~za

:: if we need ShadowSpawn, this is where it comes from
set shadpath=D:\Software\ShadowSpawn\W7x64\ShadowSpawn.exe

:: Step 1 - examine any backups in the target directory

::   initially assume that there have been no backups, so set newest to 0
set newest=0

:: obtain the newest backup file number, if any, from the target file directory
::   the 2>nul avoids an error message from DIR if there is no backup file yet, 
::   in which instance the contents of %newest% are not altered
for /f "tokens=*" %%a in ('dir "%target%\%file%.#?" /b /od 2^>nul') do set newest=%%a

:: obtain the suffix number of the most recent backup file
::   if this is 5 (or above!) then revert to 1, else increment it
set sfx=%newest:~-1%
if %sfx% GEQ 5 (set sfx=1) else (set /a sfx+=1)

:: Step 2 : check if an outlook.exe task is running, and do the backup copy

:: set up the timestamp yyyymmdd_hhmm ready for the log message
(set hours=%time:~0,2%)
:: next line assumes UK date format: dd/mm/yyyy
set stamp=%date:~6,4%%date:~3,2%%date:~0,2%_%hours: =0%%time:~3,2%

:: if Outlook is running (findstr errorlevel 0), we need ShadowSpawn,
::   otherwise we don't
tasklist /fi "imagename eq outlook.exe" | findstr /b /i /c:"outlook" > nul
if errorlevel 1 (
  rem outlook not running
  echo %stamp%  PST copy [%pstsize% bytes] made to file %sfx% when Outlook was not running>>%log%
  copy "%source%\%file%" "%target%\%file%.#%sfx%" > nul
  ) else (
  rem outlook is running
  echo %stamp%  PST copy [%pstsize% bytes] made to file %sfx% while Outlook was running>>%log%
  %shadpath% "%source%" q: cmd /c copy "q:\%file%" "%target%\%file%.#%sfx%">nul
)

:: could use xcopy, without needing cmd /c, but it's too messy (File or Directory)
::   I still haven't worked out how to pipe ECHO D to the XCOPY command!
:: %shadpath% "%source%" q: xcopy "q:\%file%" "%target%\%file%.#%sfx%" /q /y

endlocal
I discover that I am not using Robocopy, but ordinary Copy!
John Gray

"(or one of the team)" - how your hospital appointment letter indicates that you won't be seeing the Consultant...