Forum Discussion

Paige__Tanner's avatar
Paige__Tanner
Brass Contributor
Feb 27, 2024

Keep running a script even when the system enters sleep mode

Hello!

If I run a PowerShell script in a laptop and then, for example, I close the lid, the script execution is suspended. If I re-open the lid, the script execution resumes.

Is there a way to prevent this? Is it possible to force the script execution regardless of the status of the system?

 

The OS is Windows 11. In Control Panel -> Hardware and Sound -> Power Options -> System Settings it has:

"When I close the lid": Sleep (for both "On battery" and "Plugged in").

Resources