How do I set a K1000 script to only run when a user is logged into the machine? Is it possible? (Edited)
Hello,
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.
Thank you.
3 Comments
[ + ] Show comments
Answers (1)
Please log in to answer
Posted by:
chucksteel
6 years ago
For your first task, add a verification step:
Verify that a process is running: explorer.exe
Explorer.exe should only be running if a user is logged into the computer.
Comments:
-
Thanks Chuck. It's good, but if it doesn't see explorer running (meaning no user is logged in) it fails and doesn't try again later. Is there a way to get it to try again like it would if someone had clicked snooze (using the same snooze duration I set for the user prompt)? - supergreens 6 years ago
-
Scripting really isn't intended to work that way, unfortunately. Perhaps you can perform the install as a managed install? Those have an explicit install when user logged in option, and the notification options are a bit better. - chucksteel 6 years ago
-
OK. Thank you. - supergreens 6 years ago
What do you have set as the default action after the message timeout? I haven't tested a logged off system with the default timeout action to cancel. - worzie 6 years ago