How do you task Windows 7 to run Windows Backup on shutdown?

geldonyetich

Honorable
Jun 25, 2012
3
0
10,510
Basically, my data isn't important enough to require anything more than a daily backups and I shut down my computer every day. At the same time, it's a severe annoyance to have Windows Backup come up and bog down my performance if I'm in the middle of something (gaming, usually). So why the heck can't I just schedule Windows Backup to run when I shut down my computer?

For the life of me, I can't see why they make this difficult to do. Too many cooks at Microsoft? :pfff:

Anywho, I hear it can be done via scripting, but I'm going to need somebody to at least point me in the right direction of how, exactly, one scripts in Windows 7. Either that, or if you're feeling really charitable to the PEBCAK writing this message, show me exactly what to do.
 
May I make an alternate suggestion?
follow this link http://db.tt/YsLpfjwg to sign up for dropbox. then you can specify a folder on your computer to sync to dropbox or to another computer. The computers dont even need to be on the same network! for example you can sync your "My Documents" folder between your computers at work and at home. even onto your tablet or phone.
 

geldonyetich

Honorable
Jun 25, 2012
3
0
10,510
Under normal circumstances, these would be good suggestions, but they're not going to work out for me in my circumstances:

1) I've got these hard drives. Two of them. They fail at a ridiculous rate. You begin to see the necessity of backing things up: there's a fairly good chance every time I put this computer in sleep mode that it won't wake up again.

2) I'm in a shoestring budget. I can't afford to replace these drives right now. My Windows 7 will not software mirror the drives because that is apparently a feature of a more expensive version of Windows. I can't afford a RAID controller (certainly not a good one, and I'm not sure I want to subject my computer to a cheap one), and my motherboard does not have one.

3) I don't just use this computer for gaming, I do some productivity stuff (video production, ect) on here, and consequently I've got enough mutable data on these drives that Dropbox's capacity is insufficient to keep a cloud backup. (Not unless I'm willing to drop major change on it, but see #2 above.)

So the easiest solution for me? If one drive bricks (as they have twice in the past for me) I send that one to Seagate while restoring what was backed up from the remaining one.

Figuring out how to go about that, on the other hand, is not a wholly easy endeavor. Windows Backup is certainly bloaty, but it'll get the job done. I'd just like to devise a way to do that which does not involve either leaving the computer on or having it occur while I'm using it.

Oh, one more thing:

4) Yes, I could just run the backup manually, without scheduling it, but I don't trust myself to remember to do it often enough.
 


I would run them in raid 1: http://en.wikipedia.org/wiki/Standard_RAID_levels

Though I gotta say, where are you going to store the backups? you could just have a NAS server / external drive and copy/paste files, or use drive cloning software but that would be a huge file and mostly unnecessary.
 

geldonyetich

Honorable
Jun 25, 2012
3
0
10,510


Of course, having two identical drives of the same size, this was not only my first idea but the reason why I decided to get a second one in the first place while the first was coming back from Seagate via warrenty coverage. Unfortunately, I then discovered the hard way that I'm not able to run a RAID 1 for reasons I've edited into my message while you were replying. (My last motherboard had a RAID controller, but I confused that for this one.)

I think if I had the money, what I'd probably do is get a third drive - an SSD boot/cache/fastloading app drive - and upgrade my Windows 7 to an edition that supports software mirroring. Then I'd probably run these two Seagate Barrcudas in half sofwarre mirror (for the important stuff I want to keep) and half software striped (for stuff I don't particularly care if I lose but I might as well enjoy reloading it faster). A third drive is also a good idea because Windows 7 tends to be a little leery about converting the boot partition into a dynamic one.

For the time being, I'd just like a way to run Windows Backup when I shut down my computer and am disappointed to hear that's such a hard thing to do that nobody here wants to go anywhere near that.
 

venom12

Honorable
Feb 10, 2013
1
0
10,510
No easy way. But it can be done.

Method 1: shutdown script
Easy and pretty dumb - but will work for sure:
Create a short script:

line1 - run the backup command (you can use robocopy for file copy from point a to point b or you can be more advanced and run a full backup using wbadmin.exe and its parameters)
line2 - run the shutdown command (something like "shutdown -s -t 0")

Run the script for computer shutdown.

Method 2: task scheduler
The trick is that if you want to use she normal shutdown button and not a stupid script, then you have to use the windows to hook to the shutdown event.
Use the task scheduler to execute a backup script/command (like wbadmin.exe with some parameters) on shutdown event (look in your event log for the correct event ID). Not sure it will work as if the backup take more than a few seconds, Windows shutdown procedure might kill it (you can still try and let us know).

Method 3: local group policy
Use the local group policy to execute script on shutdown:
1) run gpedit.msc
2) navigate to Computer Configuration > Windows Settings > Scripts (Startup/Shutdown)
3) put there whatever you want (again script/command with parameters)

Method 4: registry
The most advanced method (similar to the #3, but no nice GUI):

Save the following text as a text file (between the lines and without them):
-------------------------------------------------------------
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\Scripts\Shutdown\0]
"GPO-ID"="LocalGPO"
"SOM-ID"="Local"
"FileSysPath"="C:\\Windows\\System32\\GroupPolicy\\Machine"
"DisplayName"="Local Group Policy"
"GPOName"="Local Group Policy"
"PSScriptOrder"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\Scripts\Shutdown\0\0]
"Script"="c:\\abcd.exe"
"Parameters"="-a -b /c /d"
"IsPowershell"=dword:00000000
"ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

---------------------------------------------------------------

Edit the contents to replace the script and the parameters with whatever you want. Note that the registry uses double \\ instead of a single one. For reference, the command that will be launched on shutdown using what I've pasted in the example:
"c:\abcd.exe -a -b /c /d"
I use Windows 7, not sure if it will work on others (however it should work even on XP).

Re-save the file as a .reg extension (if you use notepad, put the file name between "" to prevent the notepad adding a .txt automatically). Then launch the reg file and confirm you want to merge it into the registry. Make sure to backup your registry:
http://windows.microsoft.com/en-MY/windows7/Back-up-the-registry

Bottom line:
If I were you, I'd go with 3 if possible - it's the easiest one (but if you have a "home" version, you don't have the gpedit.msc snap-in...).

Disclaimer:
If you mess up your computer - it's your fault. As a general rule, you should never execute something you don't understand/don't know where it came from/don't trust the origin.

Cheers,
Leonid