Rummage through this blog

Thursday, 18 February 2010

GPEDIT.MSC & backing up on shutdown.

A handy tip for making backups - I have discovered another useful feature in gpedit.msc on Windows 7,  I presume it probably exists in XP & Vista as well but I cannot confirm having converted wholesale to Windows 7 lately.

If you run gpedit.msc and navigate to Computer Configuration >> Windows Settings >> Scripts you will find a start and shutdown option. Right click on either in the right hand pane and select properties & you will find a list of scripts to run at startup / shutdown.

I've created a short robocopy script to backup the user directories to a different destination on shutdown which gives me a little more security for my important files. Using robocopy makes the process pretty quick as I'm only copying over changes.

Here's a sample of the robocopy script :
robocopy "c:\Users" "d:\UserBackup" /log:"d:\UserBackup.txt" /np /xj /lev:10 /S /XF ntuser*.* *.tmp desktop.ini thumbs.db picasa.ini /xd "c:\Users\each user\AppData"  /ZB /R:1 /W:5 /purge
You will note that I exclude the AppData folder for each user - if my machine dies and I have to rebuild I'm only interested in user generated documents not any config details but essentially the exclude directory (/xd) and exclude file (/xf) section can be preety much as long as you like - and mine is in the live version.