What you’re running into is most likely a session context issue rather than a GPO issue. The scheduled task, requires an interactive user session. It will work when run manually in a logged-on session, but it will silently fail if the scheduled task runs in a non-interactive context (such as Session 0).
If the scheduled task is configured with:
- “Run whether user is logged on or not”
Running as SYSTEM
Or without an interactive token
then LockWorkStation will not execute properly on Windows 10/11.
For this scenario, the task should be configured as:
Run only when user is logged on
Run in the user’s security context (not SYSTEM)
Do not use “Run whether user is logged on or not”
If deploying via GPO, consider creating the scheduled task under:
User Configuration → Preferences → Control Panel Settings → Scheduled Tasks
so that it runs in the user session rather than the machine context.
This is a common issue related to session isolation.