/build/static/layout/Breadcrumb_cap_w.png
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. 

Alert User Before Run

Allow the user to run, cancel, or delay the action. This is especially important when reboots are required. If no user is logged in, the script runs immediately.


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

Comments

  • can you set the credentials to use the logged on user, as that should only then run if someone is logged on?
  • Sorry, I forgot to mention that our users lack permissions to install software.
  • If you have the "Allow run without a logged-in user" unchecked, and it executes, this would have to be some bug. Running the script from run-now to a PC without user logged in, should produce a failed run-now status.

    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.

All Answers

0
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. 
Answered 10/11/2018 by: chucksteel
Red Belt

  • 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)?
    • 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.