How to force your computer to go to sleep (and stay asleep)

One of the strangest things that can happen to your PC is a forced wake.

You’re sitting at your desk staring at a blank screen when suddenly it wakes from its slumber.  Automatically.  It’s like the computer became a sentient being and decided to ignore your commands to sleep.

When your computer wakes up automatically does that mean you have a Trojan or worse… a demon?

Let’s explore this freighting issue and see if we can ascertain the cause.

The first thing you should do when your PC wakes up without you doing anything is to check the power configuration settings.

Press the Windows logo key on your keyboard and type:

cmd

and press Ctrl + Shift + Enter.

This will open an elevated command prompt so we can do our detective work.

Who keeps waking me up!?

Let’s take a look at the last device that woke your system from its slumber.

Windows actually lets us do this with its built in powercfg utility.

Type:

powercfg /lastwake

Using powercfg to see which device last woke up your system

Here you can see I had a device plugged into my USB controller that was woke my system up.  Perhaps it was an external hard drive or USB thumb drive?

Let’s dig a little more.  We can enumerate a list of devices that are authorized to wake up the computer.

powercfg /devicequery wake_armed

Using powercfg devicequery wake_armed

The HID part in the screenshot is just an acronym for Human Interface Device.  It’s just a device that usually takes input from people rather than other computers.

In my screenshot you can see I have a HID compliant mouse and keyboard that can wake my PC.  And that’s what I would expect.

If you see anything other than those two items you should investigate why it’s there.

Telling the waking device to back off

We can use the /devicedisablewake parameter to tell the mouse to back off.

powercfg /devicedisablewake "HID-compliant mouse"

Just substitute the item name displayed in the wake_armed list with the one you want to disable.

Incidentally, you can always open the Device Manager (Windows key + Pause/Break), and disable the waking device in the Power Management tab.

So in the screenshot below you can see how easy it is to tell the mouse to let my computer snooze.

Allow this device to wake the computer

You should also make sure there aren’t any applications scheduled to wake your computer at a specific time.

We can do that with the wake timers.

Enter this command:

powercfg /waketimers

Checking out the powercfg waketimers

Let’s move on because the Task Scheduler might be involved.

Check your Scheduled Tasks

The Task Scheduler is a beast.  It can automate a million things based on a million conditions so you want to make sure there’s nothing in there bothering your PC.

Open the Task Scheduler.  You guessed it: hit the Windows key and type:

task scheduler

If you click the Task Scheduler Library in the left pane, you’ll see a list of configured tasks in the middle pane.

Click the first task in the top middle pane and then choose the Conditions tab in the bottom middle pane.

Scroll to the bottom and make sure Wake the computer to run this task isn’t enabled.  You should be able to press the down arrow key to go through each task.

Using the Task Scheduler to make sure a task isn't waking up

Don’t forget your Network Adapter!

If you really want to be circumspect we need to check the Network Adapter too.

Open the Device Manager and double click your Network Adapter.

Now flip over to the Power Management tab and make sure Allow this device to wake the computer is unchecked.

Allow this device to wake the computer

Also hit up the Advanced tab and confirm that the following settings are disabled:

  • Shutdown Wake Up
  • Wake on magic packet
  • Wake on pattern match

Shutdown Wakeup

Shutdown Wake up is pretty straightforward but the other two warrant an explanation:

Wake on magic packet means the device will wake when it receives a special network packet that has been designated a “wake-up packet”.

The other part, Wake on pattern match, means the device will get up when it matches a:

  • TCP SYN packet
  • NetBIOS name query or
  • IPv6 Neighbor packet

You can dive into the details on the Technet page but the reading is a little dense (you’ve been warned!)

Some other things to investigate

Take a quick jump into your BIOS and look for any power management settings.  You might find the culprit here.

Also, there’s one more thing you should explore: your power options.

Hit the Windows logo key and type:

power options

Windows 8.1 change plan settings

Now click the blue Change plan settings link to the right of your power plan.

Change advanced power settings

Click Change advanced power settings at the bottom of the Edit Plan Settings window.

In the Power Options window, scroll down and expand the Sleep category to confirm it’s set to Disable.

Allow wake timers in Windows Power Options

That should do it.

If you’re computer still wakes up by itself after doing this then I recommend finding a qualified Priest to exorcise it.

Your computer has bigger problems than I can solve at that point.

The Bottom Line

So in summary when your PC spontaneously wakes up without your intervention try the following things:

  • powercfg parameters
  • Scheduled tasks
  • Network adapter power options
  • BIOS power settings
  • PC power options
  • A qualified Priest.

These steps should get you well on your way.

Please share your experience with this issue in the comments below!

About

Connect with Vonnie on Twitter

Posted in Windows, Windows 10, Windows 7, Windows 8 Tagged with: ,
  • Teddy326

    Thankyou for the disable wake_timer example.
    After rebuilding Windows 7 Prof from the recovery disk – every time I pressed the power button it hibernated and then immediately woke up again.
    I was able to disable the Intel thingy that was waking it up.

  • karm42yn

    Very nice and in depth article.

  • Gio

    Hi. Will it work also for games? Usually when some game is running (even only in the background) sleep won’t be triggered. I’m trying to set Win10 to just go to sleep regardless of what is running (whether a game of some media) if no input (from keyboard or mouse) for some time. Something like the Rest Mode in the PS4, that can be set to activate after a certain amount if no input from the controller, even if you are in the game.

    • archon

      im in the same boat =S

    • Gadgetguru

      Same here

  • doug johnson

    It’s ridiculous that windows doesn’t have a master override for sleep mode, and you have to deal with everything individually like this.