Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


Aaroona

3196 posts

Uber Geek


#309349 10-Oct-2023 23:33
Send private message

I am trying to set up a iOS Shortcut to hibernate a windows machine via SSH for windows, however I am having a bit of trouble getting the sequencing right. 

 

 

 

The Hibernate command for windows I am using is "%windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Hibernate" - this works fine, but the issue is it doesnt provide a response back to say it has successfully run, nor does it give enough time for the SSH session to disconnect gracefully, therefore it causes the iOS Shortcut to hang while running.

 

I used to solve this by using Pulseway, but they have since turned to rubbish the last year+ and the iOS automation options haven't worked since. They keep promising to fix them, but haven't done it.

 

 

 

Is there a better way to run this? Or a different command I can run that returns a response that I'm not aware of? 

 

I was thinking maybe delay/powershell job might be the best option, which gives the SSH session enough time to execute the task then exit the shell.


Create new topic
fe31nz
1229 posts

Uber Geek


  #3145141 11-Oct-2023 01:03
Send private message

The usual command used to shut down or hibernate is "shutdown".  The /h option is for hibernate, and it also has options to do a timeout before acting (/t).  If that is not sufficient, then you would need to write a script and run that remotely.  It is possible to run a script as a separate task so it is not affected by the ssh connection being disconnected.




nzkc
1572 posts

Uber Geek


  #3145142 11-Oct-2023 01:03
Send private message

I'd be inclined to create a windows scheduled job (to run on demand with no schedule) that does the hibernate and have your ssh command call Start-Job to run it: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/start-job?view=powershell-7.3

I'd have the job delay for a bit so you have time for your SSH script to exit gracefully.


Aaroona

3196 posts

Uber Geek


  #3145506 11-Oct-2023 21:27
Send private message

Thanks for the suggestions. I did a bit of a mash up of the scheduled task option in the end.

 

I set up a scheduled task to run the hibernate command directly, no delays. I then run schtasks.exe /run /tn HibernateComputer and I get a successful message back for executing the task. This is enough to allow the SSH session from windows to close off, and is sufficient enough to give me confidence the computer will hibernate.

 

 

 

 

 

 

 

 

 

I had tried the shutdown.exe /t option, but /t is not valid with /h, only with reboots or shutdowns.


Create new topic





News and reviews »

Air New Zealand Starts AI adoption with OpenAI
Posted 24-Jul-2025 16:00


eero Pro 7 Review
Posted 23-Jul-2025 12:07


BeeStation Plus Review
Posted 21-Jul-2025 14:21


eero Unveils New Wi-Fi 7 Products in New Zealand
Posted 21-Jul-2025 00:01


WiZ Introduces HDMI Sync Box and other Light Devices
Posted 20-Jul-2025 17:32


RedShield Enhances DDoS and Bot Attack Protection
Posted 20-Jul-2025 17:26


Seagate Ships 30TB Drives
Posted 17-Jul-2025 11:24


Oclean AirPump A10 Water Flosser Review
Posted 13-Jul-2025 11:05


Samsung Galaxy Z Fold7: Raising the Bar for Smartphones
Posted 10-Jul-2025 02:01


Samsung Galaxy Z Flip7 Brings New Edge-To-Edge FlexWindow
Posted 10-Jul-2025 02:01


Epson Launches New AM-C550Z WorkForce Enterprise printer
Posted 9-Jul-2025 18:22


Samsung Releases Smart Monitor M9
Posted 9-Jul-2025 17:46


Nearly Half of Older Kiwis Still Write their Passwords on Paper
Posted 9-Jul-2025 08:42


D-Link 4G+ Cat6 Wi-Fi 6 DWR-933M Mobile Hotspot Review
Posted 1-Jul-2025 11:34


Oppo A5 Series Launches With New Levels of Durability
Posted 30-Jun-2025 10:15









Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.