Can I make my PC backup and then sleep on demand with WHS?

5

4

I really hate the way that WHS backs up at a particular time in the morning.

  • First of all I don't EVER want my computer turning on when I am not there. EVER. I have a Core-i7 laptop which literally could burn the house down quite easily if it were to turn on in a bag.

  • I also don't ever want my PC to sleep unless I tell it to. I don't have hibernation or sleep enabled and this is the only way that WHS will sleep after a backup is complete.

  • I know that Windows 7 has the ability to disable waking up when on battery power but it doesn't seem to work on my laptop.

These are the possibilities (with wake timers left as default):

  • 'Wake this computer for backup' ON - it turns on in my bag if i forget to turn it off - and stays on when the backup is complete.
  • 'Wake this computer for backup' OFF - it backs up in the morning, but I need to leave the machine on all night.
  • I say 'Backup Now' and then it backs up immediately. I can turn it off when its done if I'm still awake, but then that backup appears as 'locked' in the console and not 'automatically managed'.

What I'd really like to do is :

  • Click 'Backup and Sleep' and then go to bed.
  • It will backup immediately and then sleep the PC.
  • This backup must be 'automatically managed' and not appear as a 'locked backup' in my console
  • Show me a confirmation that everything was backed up successfully (or not) when I turn it on.

Is there any way to achieve this?

Simon

Posted 2009-08-02T06:14:56.957

Reputation: 592

Answers

3

I finally figured out a solution to this that works quite well for mw.

Basically I wrote a script to run a backup and then sleep immediately when complete.

  • Disable wake timers (if using Windows 7). This should prevent your PC from waking up at your normal backup time. Unfortunately there is no way to disable backups while still allowing manual backups to be triggered.
  • Set the backup time to be a time when you're asleep - like 4-5am
  • Replace 'IKE' below with the name of your server
  • Rename C:\Program Files\Windows Home Server\BackupEngine.exe to _BackupEngine.exe. I couldn't find any other way to completely prevent backups being automatically triggered. When i turn on my PC again in the morning it was trying to backup immediately.
  • Run this .BAT file as an administrator (important):

    echo %date% %time%
    ping ike
    sleep 5
    echo STARTING BACKUP %date% %time%
    del "C:\Program Files\Windows Home Server\BackupEngine.exe" 
    "C:\Program Files\Windows Home Server\_BackupEngine.exe" -a -d "Manual Nighttime Backup" -s ike
    echo %date% %time%
    %windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Standby
    pause
    

Note: I had to delete BackupEngine.exe in the script because it gets repaired everytime the WHS console restarts on a reboot. If this file exists it will still try to run a backup when you turn the PC on again in the morning even if the backup time has passed. Doh!

For more details about the command to 'sleep' see this.

NOTE: This is still a work in progress. Has worked for a few days and i will improve this over time. I really really want to get this functionality into Vail (WHS2) if not already there.

Simon

Posted 2009-08-02T06:14:56.957

Reputation: 592

1+1 for a scripting solution when a built-in solution did not exist – MaQleod – 2010-09-16T22:45:56.380

great job figuring out a custom solution. Make sure to mark your own answer as accepted if this has successfully solved the issue! – nhinkle – 2010-12-31T09:21:31.187

2

If you set the WHS machine to wake up at night to do a backup then it should also sleep when it's done. Have you checked your power settings so that they allow the machine to go back to sleep?

There are some options that prevent the machine from going to sleep. In device manager for mouse/keyboard you have an option to prevent sleep.

Paxxi

Posted 2009-08-02T06:14:56.957

Reputation: 6 952

the thing is i dont want this behavior. i never want my machine sleeping by itself. i might be downloading or uploading a large file - or some other long running task. i'm a programmer - not a 15 year old facebook addict. these default settings just don't work for me – Simon – 2010-09-21T06:00:26.900

2

I'm not specifically familiar with how WHD handles backups, but if it's similar to how Windows 7's built-in backup tool works, this should work. I'm not sure what version of Windows you're running on the PC you're backing up to the server; this would only work in Windows Vista or newer.

Check the Application Event Log (eventvwr.exe) for what event occurs when the backup is complete. There should be some sort of event for "the backup completed successfully" or similar. Once you find that, click on "attack a task to this event", and set the action to "run a program". Then, select a program to put the computer to sleep. I would recommend using SysInternals PsShutdown; it's a light command line tool which can put your computer to sleep. Set this to run as the action when the backup complete event occurs. This will make your computer go to sleep as soon as the backup is successfully finished. You could also just use the command %windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Standby.

I am working on developing have created a light application which displays a countdown before putting the computer to sleep or hibernate, and runs after a backup. This makes the computer go to sleep when the backup is done, but give the user a chance to cancel the shutdown if they happen to be up late working. You can download it here. The installer automatically sets up the scheduled task, but you will need to install .NET 4.0 manually if you don't already have it.

AutoShutdown

nhinkle

Posted 2009-08-02T06:14:56.957

Reputation: 35 057

great thanks. any idea if Vail improves on this situation? I just thing WHS currently completely misses the ball with respect to how and when home users want to do backups. – Simon – 2010-09-17T17:44:15.767

Sorry, I haven't heard of Vail before. Could you clarify what that is? – nhinkle – 2010-09-17T17:58:32.363

0

Any particular reason you don't just change the backup time?

I have it set for a time in the early evening when my PC's usually on, but I'm barely using it, you could just as easily set it for lunchtime or some similar time. It happily runs in the background of my PC and then finishes. If I am actually actively using the PC and the backup slows things down noticeably, I just right-click the WHS icon and Cancel the backup for that evening.

I don't set my PC to sleep, I always switch it off fully, so if I'm not in that evening it doesn't run. The next day when the PC's on, it runs ok. As long as the backup runs a couple of times a week the WHS doesn't complain, and I'm happy that my machine and data are safe.

This way it never needs to wake the machine up, never need to worry about it shutting the machine down.

Also I notice from the date that this question was posted, you must have been using a pre-release copy of Windows 7, along woth Power Pack 2 of WHS. The full release of Win 7 and PP3 for WHS play together much better.

GAThrawn

Posted 2009-08-02T06:14:56.957

Reputation: 4 176

0

power settings on your machine should put the machine back to sleep after the backup completes. I do agree that the setting would be a good one though. Have you logged this as a suggestion via the Windows Home Server Connect Site? .

Thanks,

Kevin Beares

Kevin Beares

Posted 2009-08-02T06:14:56.957

Reputation:

never actually worked before. maybe with win7 its fixed - but the problem is you only have to leave it in a bag once and its fried - or burns the house down. i was really hoping someone had made (or could make) an add in for this. maybe these kinds of thins just arent exposed via the API but i'd hope they would be – Simon – 2009-12-05T09:44:11.937