Skip to main content
Newsletter IconGoogle IconFacebook IconX IconInstagram IconYouTube Icon
Giveaway: MONTECH HyperFlow ARGB 240 or 360 AIO Liquid Cooler - Four Winners!

These powercfg commands explain why your PC wakes at night or won't sleep

Windows tracks what wakes your PC and which apps keep it awake. An elevated terminal and a few minutes are enough to track down what's behind yours.

These powercfg commands explain why your PC wakes at night or won't sleep
Facebook IconX IconReddit Icon
Comments
Guides Editor
Published
4 minutes & 15 seconds read time
As an Amazon Associate, we earn from qualifying purchases. TweakTown may also earn commissions from other affiliate partners at no extra cost to you.
Voice: Yasir Mahmood
0:00 / 7:42
Use left and right arrow keys to seek audio.

My desktop once woke itself up in the middle of the night, lit up the monitor, and sat there with its fans spinning. Nobody had touched the mouse.

Instead of flipping power settings at random, I opened an admin terminal and asked Windows what happened. As with most of the Windows 11 changes I make and the ones I avoid, the fix starts with finding the cause first.

Popular Now: G.Skill replaces a $150 RAM kit now selling for $1,199, earning a customer for life in the process

The last wake source is a clue, not a verdict

Every command here needs an elevated terminal, so press Win + X and choose Terminal (Admin) first. Then run powercfg /lastwake. It reports what pulled the PC out of its last sleep.

These powercfg commands explain why your PC wakes at night or won't sleep 01

On my desktop, it named a PCI Express Root Port, which sounds vague. A root port is a bridge, so the real culprit sits behind it, most likely my Realtek network adapter.

However, the answer isn't always there. My laptop came back with a wake source count of zero. On a desktop, Event Viewer keeps a record of each wake. Open it, go to Windows Logs > System, and click Filter Current Log.

Photo of the DELL Optiplex 7060 SFF Desktop Computer

Best Deals: DELL Optiplex 7060 SFF Desktop Computer

Prices last scanned 4 hours and 50 minutes ago

* Prices may be inaccurate. As an Amazon Associate, we earn from qualifying purchases. We earn affiliate commissions from Newegg and PCCG sales.

Pick Power-Troubleshooter from the Event sources list, then open an entry and read its Wake Source line. On a Modern Standby laptop, this log mostly says Unknown, so check the sleep study's exit reasons instead.

These powercfg commands explain why your PC wakes at night or won't sleep 02
These powercfg commands explain why your PC wakes at night or won't sleep 03

To see every device currently set to wake the PC, run powercfg /devicequery wake_armed. My desktop listed the usual trio: the keyboard, the mouse, and that Realtek adapter.

These powercfg commands explain why your PC wakes at night or won't sleep 04

To take one off the list, run powercfg /devicedisablewake "device name" with the exact name in quotes. If you prefer clicking, open Device Manager, right-click the device, select Properties, and untick "Allow this device to wake the computer" on the Power Management tab. For a network adapter, "Only allow a magic packet to wake the computer" is a gentler middle ground.

Guide Q&A

Powered by TweakBot

From TweakTown's coverage of this guide.

How can you trace the actual device behind a PCI Express Root Port wake source reported by powercfg /lastwake?

What does a Modern Standby sleep study's Top Offenders list reveal when a laptop spends little time in the LOW POWER STATE?

How can you configure a Realtek network adapter to wake a PC only for magic packets?

What are the risks of overriding a Windows power request labeled Legacy Kernel Caller?

Want something else? Ask TweakBot.

These powercfg commands explain why your PC wakes at night or won't sleep 05

Running powercfg /deviceenablewake "device name" undoes it. I'd leave the keyboard armed, or you'll need the power button every morning.

Scheduled tasks can set an alarm you never agreed to

If the wake came from a timer instead, powercfg /waketimers shows which one is armed and when it will fire. On my desktop, it was named the Maintenance Activator, and Automatic Maintenance there was set to run at 2:00 AM.

That timer comes from Automatic Maintenance, so its switch isn't in Task Scheduler. Open Control Panel, go to System and Security > Security and Maintenance, expand Maintenance, and click Change maintenance settings. Untick "Allow scheduled maintenance to wake up my computer at the scheduled time" and click OK.

These powercfg commands explain why your PC wakes at night or won't sleep 06
These powercfg commands explain why your PC wakes at night or won't sleep 07

For ordinary tasks, open Task Scheduler, find the task, and untick "Wake the computer to run this task" on its Conditions tab. The same tab matters when you build your own Windows maintenance jobs that run on autopilot.

These powercfg commands explain why your PC wakes at night or won't sleep 08

For a blanket fix, press Win + R, type powercfg.cpl, and press Enter. Click Change plan settings, then Change advanced power settings. Expand Sleep > Allow wake timers and set both On battery and Plugged in to Important Wake Timers Only. Windows then keeps timers it treats as important, such as an update restart, and ignores the rest.

These powercfg commands explain why your PC wakes at night or won't sleep 09

When your PC won't sleep, something asked it not to

When a PC ignores its sleep timer, an app or driver has usually filed a power request telling Windows to stay awake. Run powercfg /requests while the problem is happening, since it only shows requests that are active at that moment.

These powercfg commands explain why your PC wakes at night or won't sleep 10

The output splits into categories. DISPLAY keeps the screen on, SYSTEM blocks sleep, and EXECUTION lets a process keep running when Windows would otherwise pause it. Each entry carries a tag, too. [PROCESS] points to an app, [SERVICE] to a background service, and [DRIVER] to a device driver.

Closing a forgotten browser tab often solves it. My desktop had a sneakier case. SYSTEM showed a [DRIVER] entry called Legacy Kernel Caller, a generic label that hides its source. I quit iCUE and Armoury Crate first, but the entry only vanished when I closed Chrome.

On a later run, SYSTEM named a driver instead: Realtek audio, reporting an active audio stream. Closing Chrome cleared that one too, which points to Chrome's audio as the cause.

These powercfg commands explain why your PC wakes at night or won't sleep 11

When something should keep running but shouldn't keep the PC awake, set an override. powercfg /requestsoverride process chrome.exe display stops Chrome from keeping the screen on. I'd avoid overriding a driver entry like Legacy Kernel Caller, since that generic label can cover more than one source.

The request type must match the entry's category: Display, System, or Awaymode. powercfg /requestsoverride on its own lists your overrides, and repeating a command without the request type removes one.

Sleep study shows what your laptop did while you were away

On a laptop, run powercfg /a and check the top of the list. Mine shows Standby (S0 Low Power Idle) Network Connected, which means Modern Standby, so it keeps running small jobs while it looks asleep. If yours only lists Standby (S3), sleep study has far less to tell you, so stick with the first three commands.

These powercfg commands explain why your PC wakes at night or won't sleep 12

On a Modern Standby laptop, run powercfg /sleepstudy /output "$env:USERPROFILE\Desktop\sleepstudy.html" in the same PowerShell window, then open the file. In Command Prompt, swap in %USERPROFILE% instead. Adding /duration 7 covers a full week.

The session table lists each standby stretch with its battery drain and a % LOW POWER STATE TIME column, which tracks how long the laptop spent in its deepest idle state. A low percentage means something kept it busy, and the Top Offenders list inside that session points to the likely culprit.

One 31-minute session on my laptop spent 0% of its time there, and Top Offenders listed the USB host controller as active 99% of the time. Each session also records an exit reason, such as a key press or the power button, though it won't always name a device.

Fewer wake permissions make for quieter nights

Once the PC sleeps through the night, revisit the wake_armed list every few months, especially after adding a new mouse or backup software, since either can quietly add a wake permission or timer. If a laptop still drains faster than it should while it's awake, run powercfg /energy with your apps closed. It checks the awake side of power use that the sleep study doesn't cover.

Join Our Newsletter

Join the TweakTown Newsletter for daily tech updates delivered to your inbox.

See previous giveaways.

Comments

About the author

Guides Editor

Yasir covers Windows, hardware, and privacy. A Windows user since XP and a Mechanical Engineer by training, he likes digging into the technical details most people skip over. His work has also been published on MakeUseOf, spanning everything from Windows optimizations to Excel deep dives. Outside of writing, he tinkers with his custom-built Ryzen rig, watches Impractical Jokers, and listens to way too much Lo-Fi.

Right of Reply

TweakTown offers all companies mentioned in this article, or those who have supplied review samples, the opportunity to respond. If your organization would like to provide a statement or clarification, we are happy to publish it here. To submit a response, please contact us.

Stay Updated

Follow TweakTown for breaking tech news, reviews, and daily updates.

Follow TweakTown on GoogleAdd TweakTown as a preferred source on Google
Newsletter Subscription