How to Set Up a Timed Hibernate

information   Information
This will show you how to set up your computer to hibernate after a set period of time.

warning   Warning
You will need Administrator privileges to do this.




We'll be using PsTools by SysInternals to do this



PsTools can be found here: PsTools
Direct Download Link: http://download.sysinternals.com/Files/PsTools.zip

Part 1: Copying Files

1. Download the above zip file (PsTools.zip) to you Desktop

2. Right Click on PsTools.zip and select Extract All...

3. When the window opens, change the location to C:\Windows\system32\ and uncheck the box Show extracted files when complete

Note   Note
Your drive letter may be different, ie D:\Windows\system32\


-1-png
4. Once this has finished, we're all good to go!


Part 2: Using PsShutdown

Here is the various switches that can be used with PsShutdown:

-2-png

As you can see, there's a lot of features!

But we're only interested in two:

-h Hibernate the computer
-t Specifies countdown in seconds until shutdown (default is 20) or
the time of shutdown (in 24 hour notation)
By using both of these switches together, we can delay a hibernate.

PsShutdown is command line only (a Console Application) so we have to launch command through Command Prompt


Launching Command Prompt:

1. Hold the key and press R to bring up the Run box


2. When the window appears, type cmd in the box and press OK. This will now launch command prompt


3. You should now be presented with a black window with a flashing white line. This is command prompt and this is what we'll be entering our commands in.
-3-png
Hibernate Commands:

1. To launch a command, you first have to specify what program you'll be launching. In this case, it will be psshutdown.exe (it is case insensitive - ie, PsShUtDoWn.exe will still work!)

Our current command: psshutdown.exe
2. Launching the above command will do nothing, as you haven't told psshutdown.exe what you want to do. We 'tell it what to do' by using switches. These are usually hyphens (-) or forward-slashes (/) followed by letters, we'll be using hyphens as this is what is indicated in the help file. Although both do actually work in this scenario. Switches are case sensitive.

Our current command: psshutdown.exe
3. We need the -h switch to tell the psshutdown.exe that we want to hibernate (you can use other switches to shutdown (-s), reboot (-r), lock(-l), suspend (-d) and logoff (-o))

Our current command: psshutdown.exe -h


4. When we execute (type this command into command prompt then press enter) this command, it will hibernate the computer immediately. So we need another switch, the time switch -t. For ease of use, the developer (Mark Russinovich) has allowed the input of two different time forms:
  • 24 hour format - To hibernate at a set time
  • Time in seconds - To hibernate after a set time (in seconds!)
In the following example, I'll be treating the current time as 12:00 noon, and we want to hibernate in 20 minutes time.


We can now add either of the following switches to the end of our command:

  • -t 12:20
  • -t 1200
The first example makes use of the 24 hour format time. The second example makes use of the time in seconds format (20 minutes = 20*60 seconds = 1200 seconds). We can now add either to the end of our command

warning   Warning
Do NOT add both, we only need one!


Our current command: psshutdown.exe -h -t 12:20
OR
Our current command: psshutdown.exe -h -t 1200
Once you've typed what you want into command prompt, press enter. Make sure you've typed the right thing!

It should now display a message similar to this:

-4-png

And there we have it, your computer is set to hibernate after a set period of time

If you need to abort the hibernate for whatever reason, just use the following command:

psshutdown.exe -a
The -a switch is used to abort. It's a very useful one - if it didn't exist, my computer would've hibernated before I finished typing the rest of this!

Enjoy!

Tom