June 30

Automate PC Hibernation

As summer is getting summer-ish, it’s important to ensure that you’re not engaging in activity that is inadvertently emitting more heat inside your home – thus over-utilizing your anti-heat remedies such as the air conditioner and electric power. One prime example I can speak for personally is my home office. I have several Windows based PC’s/Servers and several monitors that I find had been running overnight in idle. Although many people opt to simply put their PC’s on sleep mode, I found that mine would often still wake up (largely due to intermittent current surges), so sleep mode was not effective. Apart from the unwarranted heat, an idle running PC or Server means the hardware will fail quicker due to wear and tear.

Alternatively, I found that putting PC on hibernation was better for this application. The difference between sleep and hibernation is that sleep mode still uses power, as it maintains all your open applications in RAM, whereas hibernation mode does not use power since it actually saves your applications physically to the hard drive. This is also why putting your pc into and out of hibernation can take substantially more time than that of sleep mode.

I did a bit of research to find how we can force hibernation because wouldn’t it be awesome to just have your PC hibernate automatically based on a schedule of your choice? I am all for automation and bots to outsource my responsibilities whenever possible!

We can use the following command (in command prompt) to signal the PC to hibernate:

rundll32.exe powrprof.dll,SetSuspendState 0,1,0

We can actually go ahead integrate this into a batch file. Open any text editor and paste the command in, making sure to save as a .bat or equivalent extension.

Now, we can simply use the windows task scheduler to run this file (which would execute the hibernate command) on a scheduled basis. In my use-case I found 12:30A.M. to be the ideal time.

And there you have it, an automated hibernation solution.

Now, if you don’t mind, I have to go catch some sleep.


Tags: , ,
Copyright 2020. All rights reserved.

Posted June 30, 2020 by admin in category "Automation

Leave a Reply