Find computer last wake target

In Windows when you put the computer to sleep, it is allowed to wake on input from certain elements. Sometimes this is annoying because certain USB devices connected that you are not aware of are waking the computer unexpectedly like a yubikey.

Found this out by using the following command

powercfg /lastwake

> powercfg /lastwake
Wake History Count - 1
Wake History [0]
  Wake Source Count - 1
  Wake Source [0]
    Type: Device
    Instance Path: PCI\VEN_8086&DEV_7A60&SUBSYS_50071458&REV_11\3&11583659&0&A0
    Friendly Name: Intel(R) USB 3.20 eXtensible Host Controller - 1.20 (Microsoft)
    Description: USB xHCI Compliant Host Controller
    Manufacturer: Generic USB xHCI Host Controller

In this case the yubikeys are attached to the usb hub that is then plugged into the computer. It is periodically waking the computer even in sleep mode. Once you identify which component is waking the machine you can disable it's ability to do this by going to Device Manager and turning off the power management wake option for it

Find the devices that can wake the computer

powercfg -devicequery wake_from_any

powercfg -devicedisablewak "Intel(R) USB 3.20 eXtensible Host Controller - 1.20 (Microsoft)"

That should fix it for at least waking from that device unintentionally