brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: powercfg /lastwake shows what woke your PC

CLI
~/tips/tip-windows-powercfg-lastwake-wake-armed

powercfg /lastwake

Shows what woke the PC from sleep and which devices are allowed to wake it.

A PC that wakes up at night, or the moment I touch the desk, is irritating. Windows can tell me what woke it, and which devices are allowed to.

Three powercfg commands do the detective work. /lastwake reports information about what woke the system from the last sleep transition. /waketimers enumerates the active wake timers, whose expiry can wake the system from sleep and hibernate. And /devicequery wake_armed lists the devices that are currently configured to wake the system from any sleep state.

powercfg /lastwake
powercfg /waketimers
powercfg /devicequery wake_armed

The first tells you what happened, and the other two show what could have caused it. A typical outcome is a mouse, a keyboard or a network adapter in the armed list, and a scheduled task in the wake timers.

To stop a device from waking the PC, take the name exactly as wake_armed printed it and pass it to /devicedisablewake:

powercfg /devicedisablewake "Device name from the list"

The docs example uses a USB mouse name in quotes. The opposite command is /deviceenableawake, and the page says the names for that one come from powercfg /devicequery wake_programmable, the devices that are user-configurable to wake the system.

My advice is to change one device at a time and to write down which one you changed. These commands change the power configuration of the PC, so a keyboard that no longer wakes the machine might be your own doing weeks later, and the opposite command gives it back.

The caveat is that /lastwake only covers the last sleep transition. If you run it after you already woke the machine yourself, the answer is you. Run it soon after you find the PC awake without you touching it.

Further reading: Powercfg command-line options

More CLI tips printf 'GET /\r\n' | hexdump -C hexdump -C -s 512 -n 64 disk.img wget --limit-rate=2m https://example.com/big-file.iso wget --spider https://example.com/file.zip rg 'apiKey' -g '!*.min.js' -g '!package-lock.json' All CLI tips (46) All topics

Link