Home » Questions » Computers [ Ask a new question ]

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

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

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

Asked by: Guest | Views: 266
Total answers/comments: 2
Guest [Entry]

"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."
Guest [Entry]

"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."