How do I set a K1000 script to only run when a user is logged into the machine? Is it possible? (Edited)
10/10/2018 971 views
I have a script I need to deploy with the K1000 and I've been asked to have it run only when a user (any user) is signed into the machine [I'm running the script as System]. The reason is that it installs a program and triggers a reboot they don't want happening until a user has told it to start. The documentation indicates that the option to alert the user before running will automatically start the script if no user is currently logged in. I do also already have the option below that to run the script without a user being logged in unchecked, but it's still running automatically when no user is already logged in.
It seems strange that scripts run without a user signed in automatically by default when there's an option below that to specifically "Allow run without a logged-in user". It's very redundant and it makes it seem at first glance like this will not run without a user signed in if that checkbox isn't checked - which isn't true. So I'm not even sure what the checkbox is meant for anymore, maybe a holdover from past versions?
Anyway, if there's nothing in the k1000 script task to be adjusted, is it possible for me to add a line into my script so that if a user is not seen to be logged in, it sets something (a task ini file on the machine or whatever is used to track the task itself) and therefore tricks the agent into thinking that someone clicked the snooze button - making the task wait until the snooze duration expires and then rinse and repeat? I'm open to ideas. Anything that lets the script simply not do the install while no one is logged in. Everything is fine when someone is signed into the machine; it prompts like it should and everything there is great. I just don't want it to do anything when no one is signed in.