* Automate FH customisations backup

Questions regarding use of any Version of Family Historian. Please ensure you have set your Version of Family Historian in your Profile
Post Reply
avatar
Mark1834
Famous
Posts: 233
Joined: 27 Oct 2017 19:33
Family Historian: V6.2
Location: South Cheshire

Automate FH customisations backup

Post by Mark1834 » 16 Nov 2020 22:39

I was looking at how best to automate backing up FH settings and customisations. I routinely copy the ProgramData and AppData folders as part of my daily FreeFileSync backup routine, but that misses all the stuff that is in the Registry. The Backup and Restore Family Historian Settings plugin captures most of the rest, but I have to remember to run it whenever I make a change.

It occurred to me that a simple three line batch file should do the job:

xcopy the ProgramData folder to a backup location
xcopy the AppData folder to a backup location
Reg export "HKEY_CURRENT_USER\SOFTWARE\Calico Pie\Family Historian" backup location


The plugin also references HKEY_LOCAL_MACHINE\SOFTWARE\Calico Pie\Family Historian, but that is not present on either of my PCs.

Such a file could readily be setup to run automatically, say every time FH is opened, or every time Windows is booted, once a day, or whatever fits the user requirements. All settings guaranteed up to date, completely automatically.

I've tried it on a test PC, uninstalling FH and manually deleting the ProgramData and AppData folders and Registry key that the uninstaller leaves behind. On re-installing the program, copying the data files back and importing the Registry key (simply double click on the backup file), it seemed to be exactly as I left it before, with all my customisations restored. It can even be done as a standard Windows user, and doesn't need elevated admin privileges.

It seems far too simple, so what have I missed....?
Mark Draper

User avatar
tatewise
Megastar
Posts: 19158
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Automate FH customisations backup

Post by tatewise » 16 Nov 2020 23:17

Here is a summary of some other things to consider.
  1. On a 32-bit PC HKEY_LOCAL_MACHINE\SOFTWARE\Calico Pie\Family Historian does exist.
    On a 64-bit PC it is HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Calico Pie\Family Historian.
  2. Consider Backup on a 32-bit desktop and Restore on a 64-bit laptop or vice versa where two copies of FH are installed.
    Consider things like Default Project path and Default Backup path being different on those two PC and held in Registry.
    What about different customisations that have been updated on both? See 8. below.
  3. Presumably xcopy actually works on:
    C:\ProgramData\Calico Pie\Family Historian and …AppData\Roaming\Calico Pie\Family Historian
  4. Also xcopy ...\Public Documents\Calico Pie\Family Historian\Tutorial Files that some users may have.
  5. Customised Diagram settings can use image & icon files located anywhere on the PC.
    How will they be backed up and restored?
  6. That batch file technique won't work in Crossover/WINE/POM emulators on an Apple Mac.
  7. Some users like to keep multiple dated backups in different folders.
    Consider what would happen if customisations were accidentally deleted and the Backup script automatically-runs.
    How would those customisations be Restored?
  8. What happens to customisations added after the Backup script runs?
    They only way around that is to run the script every time FH is closed.
    The Plugin checks file modification date/times to prevent new customisations from being overwritten by mistake.
  9. When FH is upgraded, Backups must be deleted, otherwise Restore will probably damage many settings.
  10. The Plugin also provides ways to backup and migrate between FH versions and parallel beta test versions.
Why not simply have a scheduled message reminder to run the Plugin?
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
BillH
Megastar
Posts: 1505
Joined: 31 May 2010 03:40
Family Historian: V6.2
Location: Washington State, USA

Re: Automate FH customisations backup

Post by BillH » 17 Nov 2020 00:50

For me I just started running the plugin any time I made any customization changes. It took a few times for me to remember, but now I remember to do it automatically.

Bill

avatar
Mark1834
Famous
Posts: 233
Joined: 27 Oct 2017 19:33
Family Historian: V6.2
Location: South Cheshire

Re: Automate FH customisations backup

Post by Mark1834 » 17 Nov 2020 09:49

Thanks Mike, that's exactly the constructive challenge I was after.

There's no way a simple four line batch script will replace a complex 6000 line plugin that has to cater for many different scenarios, and that is obviously not the intention. However, it does sound like a very viable alternative approach for easy backup and restore to the same PC, or another one running the same versions of Windows and FH.

It's a complementary approach to that of the plugin. The full-fat plugin has to be complex to be comprehensive. It can be used by anybody as a black box that simply does a specified job, but I suspect very few will try to customise it due to its complexity. This approach is much easier for somebody with intermediate IT skills who likes to know and control what is happening on their system (like me!) to adapt and incorporate into their general backup strategy. It also makes it easier to understand what the backup is actually doing.

At its simplest, it's a batch file called manually (say by a desktop shortcut), just like the plugin, or it can be automated as required. It's offered as a suggestion for folks to ignore or run with and adapt as they see fit.

If automated, your point about having a rollback facility is a good one, but that's no different to any other automatic backup routine, and readily addressed by having multiple backups, using File History or OneDrive/SharePoint, etc. It's only limited by the user's imagination.

As for migrating following upgrades, the full plugin always remains available for special cases.
Mark Draper

User avatar
tatewise
Megastar
Posts: 19158
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Automate FH customisations backup

Post by tatewise » 17 Nov 2020 11:03

There is a challenge even if you want to backup on one PC and restore on another PC with same FH Version, etc.

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Calico Pie\Family Historian\2.0\Preferences has keys such as:
FH Root Folder = C:\Users\Mike\OneDrive\Documents\Family Historian Projects
Default File = C:\Users\Mike\OneDrive\Documents\Family Historian Projects\...\Family Historian Sample Project.ged
Backup Directory = C:\Users\Mike\OneDrive\Documents\Family Historian Projects\Backup

Note that the paths include C:\Users\Mike\ where Mike is my username on one PC.
If the equivalent paths on the other PC have another username or any other difference, then the Restore will corrupt them!

For similar reasons don't backup HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Calico Pie\Family Historian\2.0 because that holds FH Version numbers, licence keys, etc, that may be different on another PC.

You are starting the same journey I started 8 years ago and quickly discoverd that a Batch file approach had deficiencies that were too complicated to solve with batch scripts and relied too much on manual disciplines.
As you say, it is possible to keep separate copies of backups and use other strategies.
However, you started from the premise that you can't remember to use the Plugin and wanted something automatic.
Those manual disciplines and workaround strategies seem to have moved away from a simple automatic backup.

I still don't understand how an automatically scheduled Batch script will cope with arbitrarily changing customisation files that includes new files, edited files, and deleted files, where that set of files may have different changes in the FH copies installed on two PC. That will require a great deal of manual discipline to work without catastrophes.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
Mark1834
Famous
Posts: 233
Joined: 27 Oct 2017 19:33
Family Historian: V6.2
Location: South Cheshire

Re: Automate FH customisations backup

Post by Mark1834 » 17 Nov 2020 13:10

Fair challenge. My original concept was for something that sat in the background invisibly and provided a quick and convenient way to restore FH on the same PC to exactly the state it was in before a disk re-image or catastrophic crash. I do most of it already by routinely backing up the ProgramData and AppData folders, so capturing the two Registry keys is just the icing on the cake to complete the copy. I would put the same routine on the laptop, so it captures its own independent configuration backup (data files are synced via OneDrive).

If I restrict it to just that and avoid the temptation of scope creep, this approach sounds ideal. It complements the plugin, which remains the tool of choice for anything more complicated, but I don’t have to run it nearly as often.
Mark Draper

User avatar
tatewise
Megastar
Posts: 19158
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Automate FH customisations backup

Post by tatewise » 17 Nov 2020 15:10

Yes, that can work assuming the backups are on an external media unaffected by a disk re-image or catastrophic crash.
If the backup media is permanently connected to the PC, then it may suffer the same fate as the PC in a catastrophic crash such as a power surge due to lightning or a fire or flood. So cloud storage is a good solution.

There is one more challenge that needs considering.
Custom Diagram settings can use icon & picture image files located anywhere on the PC.
The Plugin searches Diagram customisation files for such file paths and backs up those image files.
The workaround that you could employ is to ensure all such icon & picture image files are located within the ProgramData folder, or within the Family Historian Projects folder, or protected by your other general PC backup regime.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
Mark1834
Famous
Posts: 233
Joined: 27 Oct 2017 19:33
Family Historian: V6.2
Location: South Cheshire

Re: Automate FH customisations backup

Post by Mark1834 » 17 Nov 2020 22:39

Sorted. I launch FH with a desktop shortcut that calls this batch file. It has the same familiar green and black icon as FH itself, and the open command window sits neatly minimised on the Taskbar waiting for me to finish, so it is no different to running FH normally from the Start Menu. When I close FH, it automatically creates a complete and up to date settings backup in my Documents folder using a combination of Reg export and robocopy (I was showing my age using xcopy in the first draft - it's been deprecated for years :) ). I’ve decided I don’t need a rollback option, as this backup is there mainly for disaster recovery. For anything else, the full plugin is available, but I won’t need to run it very often. I don’t need to search for Diagram files, as everything will be in backed up folders.

Code: Select all

"C:\Program Files (x86)\Family Historian\Program\Fh.exe"

Reg export "HKEY_CURRENT_USER\SOFTWARE\Calico Pie\Family Historian" "%OneDrive%\Documents\Family Historian Settings\fhCURRENT_USER.reg" /y
Reg export "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Calico Pie\Family Historian" "%OneDrive%\Documents\Family Historian Settings\fhLOCAL_MACHINE.reg" /y

robocopy "%PROGRAMDATA%\Calico Pie\Family Historian" "%OneDrive%\Documents\Family Historian Settings\fhProgramData" /MIR
robocopy "%APPDATA%\Calico Pie\Family Historian" "%OneDrive%\Documents\Family Historian Settings\fhAppData" /MIR
All my data folders (Documents, Pictures, etc) are in OneDrive, so backed up to the cloud in real time. I also mirror them (and other selected configuration folders) to my NAS daily, and mirror the NAS files to a USB hard disk approximately monthly (“rule of 3” backup). About every 3 months, I also store a full disk image on a second USB backup, so I think I’ve covered all the bases for a home user.

All I need to do now is copy the same file to my laptop. With a minor adjustment to file and folder names, the two independent backups can sit side by side in OneDrive.
Mark Draper

Post Reply