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 /purgeYou 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.