Can't keep remote PC awake
Hi.
I have numerous PCs (and a couple of networks) that I look after for my flying club two of which are desktops. I back them up to local drives once a week and is never a problem. The laptops only have one drive of course, meaning I have to back them up to a network drive, again not a problem per se. However the desktops need to be woken up to do that and I have struck a problem. I have used a Wake on Lan command which works but if the backup is large, the desktop will go to sleep before it finishes if it's longer than the sleep timer (yes I know I can lengthen the timer but "how long is a piece of string?"). So I've used the psexec function from PSTools to instigate a little bit of code called insomnia.exe to keep it awake and it works fine from the command line and from the batch file I created. My problem is I can't run the command line or the batch file from the pre/post commands in ATI 2019 it just stalls and returns an error. I did read that you can't run executable files from the pre/post commands but it isn't running them on the local PC, in fact it's runs a batch file on the remote PC (a batch file on the local PC calling a batch file on the remote unit). Does anyone have an idea of how I can get around it?
Cheers
daylef


- Log in to post comments

Hi thanks for responding.
I think you may have missed a step in my description. I'm trying to wake a remote PC so that the local laptop can write to the remote PC's backup drive, then send a command to allow the remote PC to sleep once the ATI backup has completed. I am able to wake it up, stop it from sleeping and put it to sleep using psexec commands on the Windows 10 command line, but I cannot use them as pre/post commands in the Advanced tab in ATI, it just returns an error.
Dayle...
- Log in to post comments

OK, Dayle, now I see what you're talking about.
Are the laptop backups done on a schedule? If so, you could schedule a task on the remote PC to wake it up say a minute before the scheduled backup.
EDIT: I went back to an old thread I started a couple years ago when I had issues with Pre commands. The behavior was somewhat different depending on whether I executed .bat, .cmd or .vbs files. Maybe that can help.
-Bruno
- Log in to post comments

So, assuming the backups are set to run at a set time... Why not use a scheduled task on that machine to wake itself up?
As for keeping it awake while it is being used as the backup source, not sure in this case. Ideally, if you need a storage pool available, you would not use power savings (i.e. a server or NAS), in that case. Otherwise, if you can at least find a reasonable window, then script caffeine to keep the machine active for say, 2 hours and then stop it after that so it can go back to sleep after that time. Better to be awake for a couple hours than all day of you want to have power savings and an available backup location when needed.
- Log in to post comments

Guys
This is getting the better of me.
I've created a batch file with the extension .bat and with the extension .cmd both with same content
"psexec64 \\NGC1 C:\utils\insomnia.exe"
Both start Insomnia.exe on the remote PC (NGC1) from the Windows command line.
If I try to run either in the ATI command line, I get nothing or "unrecognised command etc" which appears to be a path issue but I have checked for included paths. It seems the command lines are different in the way they function despite what I read about the ATI function. I've tried capturing debug info but that is always empty.
I'm thinking this is a hiding to nothing and I should just stick with WoL and extend the sleep timers which begs another question. Can I change the sleep timers in the registry?
Cheers
Dayle...
- Log in to post comments

Guys
This is becoming a significant frustration.
I've created two batch files with the same content, one with a .bat extension and with a .cmd. If I run them from the Windows command line they work perfectly, but running from the ATI command doesn't happen. Both files yield different results. The .cmd file just stalls but often tell me the file cannot be run (unrecognised command or application etc) which tells me it could be a path issue but I have checked and/or added paths to the system variables. The .bat file just flags an error (task not completed) which I tend to think ATI has a different command function.
I starting to think the WoL option with an extended sleep timer is the best solution, which brings up another question, "can I change the sleep time in the registry"?
Cheers
Dayle...
- Log in to post comments

Dayle,
If you are getting an unrecognized command error, have you tried putting the full path name to psexec64?
As for sleep timers, you can use the powercfg command. Create a new power scheme to be run while the backup is going and use powercfg to switch schemes. As mentioned earlier, if your backup is on a schedule you could create a scheduled task on the remote PC which could wake up the computer and set the new power scheme. Then you would not need a Pre-command and you would not need the insomnia.exe. A Post command would be needed to reset the power scheme. If that fails, I could see running a script when the backup starts which could do a periodic check (say every five minutes) watching for when the backup would be done. Not sure yet what it could key on though.
-Bruno
- Log in to post comments

I could see running a script when the backup starts which could do a periodic check (say every five minutes) watching for when the backup would be done. Not sure yet what it could key on though.
Bruno, I use the following in PowerShell to check for my ATI active task ending...
wait-process TrueImageHomeNotify, TrueImageHomeService -ErrorAction SilentlyContinue
- Log in to post comments

Steve, what I was suggesting is a script which would run on the remote PC where the backup is being written. This is not the PC (laptop) running ATI.
- Log in to post comments

You could have a Pre Command that creates a file on the remote PC when the backup starts, then deletes it again via a Post Command, coupled with a task on the remote PC that watches for the file being gone before putting it back to sleep again?
- Log in to post comments

Steve, that may work as it doesn't require getting the remote PC to do anything. Hopefully, Dayle could get that command to work. And if using a scheduled task on the remote PC, no need for the pre-command as the scheduled task could create the file.
- Log in to post comments

Daylef,
I'm coming to this a bit late, sorry, but I'd like to tackle it from a different direction.
Unless these "desktops" are really old they should never go to sleep while they have open network files (either being read or written to). By default, all versions of Windows at least (I think) since Vista, certainly since Windows 7, disable sleep while transferring files over the network, in either direction.
I would start off by looking into two things.
- Is there any chance that for some reason your backups pause for a while after waking the remote system? When Windows is awoken by a scheduled task or by the LAN it is considered "unattended". Windows has a separate sleep timer when "unattended", which by default is 2 minutes. It is not supposed to be changed but can using this method: https://www.tenforums.com/tutorials/72133-add-system-unattended-sleep-timeout-power-options-windows.html. This timer should not start unless all file transfer has stopped, but if for some reason no transfers happen for 2 minutes this could be the cause of your problem. If the pause is necessary you could extend the time the computer stays awake.
- There is a setting to allow sleep while remote files are open. It is off by default on all new installations but, if you have taken over these systems, maybe someone changed it for some reason?? This describes how to change: https://www.tenforums.com/tutorials/72143-add-allow-sleep-remote-opens-power-options-windows.html
If you fix the problem of the backup destination going to sleep, which really should not be happening, you won't need to use pre/post commands at all. :)
- Log in to post comments