PDA

View Full Version : Win7 shutdown backup via GPE?


Thrust Augmentation
7th Apr 2017, 09:10
I'm trying to create a backup of specific files & folder at end of day shutdown which I believe can be done with a batch file & group policy editor in Win7 Pro.


I'm not that familiar with batch files or GPE, but it doesn't look too daunting, the only issue I have is that the backup would have to be configured to run only if some time based criteria were met - something along the lines of only occurring between the hours of X & Y, not outwith. This is simply to prevent the backup running inadvertently should a shutdown be required during the working day.


Is this possible using GPE?


(I've also got Acronis True Image, but from what I can make out it's a bit dumb / limited on shutdown options)


Thanks.

Saab Dastard
7th Apr 2017, 17:10
It sounds like a possible solution is to use the task scheduler. Create a task to backup your files followed by a shutdown when the backup completes, and schedule it to run daily at a time of your choosing.

I don't see why group policy is required here, unless you are dealing with multiple computers in a domain.

SD

Thrust Augmentation
7th Apr 2017, 21:47
SD - thanks for your reply;


Task scheduler isn't ideal as shutdown happens variably in a 1 hour or so window & the computer isn't left on site (so, scheduled task cant be set up to occur later), so ideally it would be driven by shutdown & not a specific schedule.


Acronis can be set up to shut down automatically at backup completion, but this would require actively starting Acronis before shutdown & in this scenario it unlikely to happen...

Avtrician
8th Apr 2017, 09:45
You could write a batch file called powerdown (or similar) linked to a shortcut on the desktop, or just make a shortcut to acronis called shutdown/powerdown.

That will run your backup, and then shutdown when completed. just double click the shortcut when you want to go home.

CaptOveur
10th Apr 2017, 02:40
You could certainly define a shutdown script with local policy to invoke your backup, but the time of day logic would need to be in the script itself. If the earliest you'd want a backup upon shutdown is 4 PM, that could be as straightforward as: if /i %time% LSS 16 goto EOF
<backup command(s)>And if you need more flexibility there's always PowerShell. :8

Regarding the task scheduler, while you could define a trigger on the User32 event ID 1074 in the System log, I'm not sure if that would give your backup enough time to complete.

Thrust Augmentation
11th Apr 2017, 20:17
Thanks all.

JimR
12th Apr 2017, 01:17
Thrust, I guess you are wanting to do the programming for fun.
If not why not just use a commercial product. I like EaseUS Todo backup. It can be configured to do just about any of your requirements.

Mac the Knife
16th Apr 2017, 12:37
You should be able to do this using xxcopy (free from Pixielab and much much faster than almost all accelerated copy programs that I know) and the "shutdown" command in a batch file. You can even turn the batch into an executable if you like.

I'll have a fiddle this evening.

Just love batch files and some of the weird and wonderful things you can make 'em do for fun.

And of course, as someone said, there's always the brilliant Powershell (though it has a bit of a learning curve and a few traps)

Mac

:ok:

PS: EaseUS works, but I don't like it.