So last night, the actions taken by my script caused a problem with Outlook’s storage file. Just to review, what the script did was: a) execute the Outlook.Application.Quit method to instruct Outlook to shut down; b) wait until outlook.exe dropped off the process list; and then c) execute a SyncToy folder pair that backs up the PST file (among many others.) Since I haven’t been able to get this working from Task Scheduler yet, I’ve been running it right before I turn off the monitor for the night. In the morning I check the log to see what happened.
This morning Outlook was sitting there with a message “The default data file cannot be opened” or something like that. Gulp. I closed it and Outlook exited. Gulp. Repeated this action a couple more times with the same result. Navigated to the storage file folder in explorer and it seemed like someone had a lock on that file, or there was a hung operation. Rebooted, and when Outlook started this time it displayed the message about the storage file not being properly closed, did a quick scan and then opened fine. Whew. I have something like 10 years of stuff in that stupid 1.2 GB file (and a separate .8 GB archive).
Checking the SyncToy log I saw that it reported two failures in that folder, which is what usually shows up when it can’t copy Outlook.pst. That sort of indicates that Outlook didn’t fully close and release its death grip on the file, although the script log did confirm that outlook.exe was not to be found in the process list once the close command had been sent. This was all semi-fun to dig into at first, but it’s sort of become a giant pain in the ass. I ought to be able to back-up my Outlook file without shutting down the program to do it. SyncToy uses Volume Shadow Copy, and it backs up a lot of other stuff that is in use too.
To be fair SyncToy does fail on some other stuff in the user folder tree, but I am less concerned about that, and I can understand if some of the goings on in AppData cause files to be uncopyable. But why should my email/calendar program have such a headlock on its storage file that it can’t be backed up using VSC? I’m assuming someone out there knows the answer to this question, and many others of deep and lasting import. It all seems to me like an increasingly good argument for online mail/contact/calendar apps that you don’t have to back up yourself. Or maybe I should just migrate to Thunderbird.