I'm having a tough time getting my PowerShell script to run automatically using Task Scheduler. The script is designed to re-enable my screensaver, which games have been disabling. I've set up the task according to the following steps: 1. Created a new task in Task Scheduler with a name and selected options like 'Run with highest privileges' and 'Run whether user is logged on or not.' 2. I configured triggers for both 'At log on' and to repeat every 5 to 10 minutes. 3. Under actions, I entered the path to PowerShell and included the necessary arguments to execute my script located at 'C:ScriptsReapplyScreensaver.ps1'. 4. I made sure to uncheck all conditions and checked 'allow run on demand' in the settings. Despite completing all steps, the task status shows it's triggering every 5 minutes, but the script doesn't seem to be running. Any ideas on what I might have missed?
3 Answers
Try adding some print statements in your PowerShell script to log output. This can help you see if the task scheduler is attempting to execute the script or if it's failing silently. Also, make sure you're not hiding the PowerShell window, so you can spot any error messages directly.
Consider removing the 'Run whether user is logged on or not' option for now, since it seems you're the one interacting with the system. Also, keep in mind that some full screen games will prevent your screensaver by keeping the system awake. You could check for any 'Gamer Mode' settings that might be causing this disruption.
One thing to check is whether your scheduled task is running as your user account. Since your script modifies user-specific settings, it should be executed in the context of your account. You might want to uncheck the 'Run whether user is logged on or not' option to simplify testing.

Got it! I'll remove the hidden setting and see what happens. Thanks!