/build/static/layout/Breadcrumb_cap_w.png

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. 

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
  • can you set the credentials to use the logged on user, as that should only then run if someone is logged on? - Hobbsy 5 years ago
  • Sorry, I forgot to mention that our users lack permissions to install software. - supergreens 5 years ago
  • 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. - worzie 5 years ago

Answers (1)

Posted by: chucksteel 5 years ago
Red Belt
1
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 5 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 5 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ