Lukas
Lukas

Reputation: 170

Preventing Scheduled Task from Running During Modern Standby

I'm encountering an issue with a compiled PowerShell script (packaged as an EXE) that is scheduled to run regularly on several computers. The script performs various checks, but I've noticed that it sometimes starts during Modern Standby mode, or just before/after the computer enters this state. When this happens, the script fails to access certain resources, such as WMI, resulting in a "call cancelled" error message. This leads me to believe that WMI services might not be fully operational during Modern Standby. Additionally, the script execution logs show significant delays between commands when in Modern Standby (up to 30 minutes between two commands that would normally execute in under a second on an active system).

Running the script during Modern Standby is not essential for our operations. I'm looking to either prevent the scheduled task from starting during Modern Standby or ensure that it stops immediately if the system enters Modern Standby while the task is running. I'm seeking advice on how to implement such restrictions or checks within the script or the task scheduler.

Is there a way to detect Modern Standby mode within a PowerShell script or configure the task scheduler to avoid running during these periods? Any insights or suggestions on how to tackle this issue would be greatly appreciated.

Upvotes: 1

Views: 84

Answers (0)

Related Questions