Windows 10 Windows 10 Sleep Issues on Gaming PC, Creating Custom Task To Force Sleep


New Member
Mar 6, 2022
Hi Guys,

This is my first post! Before I begin I have done some reading up on this issue but not found a solution specific to my problem.

My kids had a PlayStation 4 which packed up last month. Instead of buying them a new PlayStation (I refuse to pay playstations ridiculous prices for their consoles and games now) I built them a Core i5 gaming rig. Best thing I ever did!

So, the PC is running great but there is an issue. The kids don't always remember to shut the PC down when they are not using it. Several times iv walked into the room and found that it's been left on for most of the day. So, I have done the usual.. Made sure all USB controllers, keyboard, mouse etc are set in device manager to prevent waking the machine, made sure power settings and timers are setup correctly, however it seems the games are preventing the PC from going into sleep mode.

The PC will sleep after 10 minutes if no applications or games are running, but if a game is left running the PC will not sleep. I think I have tried everything now to get around the problem but I'm now at a loss.

I'm wondering if a script could be written to force the PC to sleep, and have it actioned by a task in Task Scheduler if the PC does not detect any input from the keyboard, mouse or game controllers after a period of time? Has anyone tried this before or found a better solution?

PC is running on Windows 10 Pro


Media, games, services and drivers can all prevent the computer sleeping by modifying the thread execution state. A script wouldn't be able to make the system enter sleep or it would simply wake back up due to the same reason.

Some suggestions
  1. Teach your kids why it's important and have them do it
  2. Kick off a script on logon (calculate the time in seconds) for when you would like the computer to power off and issue a timed shutdown command shutdown.exe -t (time in seconds)
  3. Run a script that will kill all game processes at a certain time
  4. You could look for specifically last keyboard and mouse imput in a script but this can get a bit tricky as you will have to call windows internal functions. Something like this Link Removed