Posted on 06-07-2022 08:15 AM
Im trying to use the screen unlock as a custom trigger. To break it down, I want a package in a policy to install/run when a user logs in (no problem using the login trigger) OR when they unlock their screen. Any ideas?
Posted on 06-07-2022 10:43 AM
Well, there's no such trigger of course, so this doesn't seem like it will be easy to accomplish.
I think the best you can do is call a policy normally, but use a Before script that loops and checks to see if someone is logged in and their screen is unlocked, and when that condition occurs, continue with whatever it is you're trying to accomplish. But this means keeping a policy "running" for, in some cases, an extended period of time, which isn't really a great idea I think.
In case this helps, there's a post here that has a helpful script for detecting if the screen is locked/unlocked. (not the python one, since python is now deprecated)