-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scheduled Task Shutdown #1
Comments
You've found an interesting case. Your second option runs in what is known as interactive mode. It can display things to a user in an interactive logon session. That's simple enough, and was the case I originally considered when writing this. Your first case... to be honest, I'm not sure what exactly it does beyond not requiring an interactive session. This program requires a message queue for the timer that eventually triggers the shutdown - and I wouldn't expect a message queue to exist without a logon session. So it probably creates its own session behind the scenes. I don't think there's a supported way to hijack a session from a different one. The best that could be done would be a process that's constantly running in the background on every session, and the scheduled non-interactive process communicating with these processes. Another option is to have one scheduled task for each case - one for the "no users logged in", and one for the "user is logged in". Need some way to detect there's no users logged in. A (rather ugly) way of doing that would be to use other tasks to enable the shutdown task on user log out, and disable it again on user log in. Another way to detect would be to have the logged in one run a little earlier, so the two can communicate (and the second won't run if the first is active). Incidentally, do you have multiple users on the same machine? Seems like that would require you to create one task per user anyway. |
Thank you for the quick response. I tried running the "logged in only" scheduled task follow by the "logged out or in" one shortly afterwards and the "logged out or in" one just shut me down without a warning or option to abort. I was logged in when both tasks started. I will have to try using the "if computer is idle" option within the task scheduler to get the PC's at login screens, then have different tasks running at different times. I really appreciate your swift reply though. Thanks |
Hm. Let me try something. It shouldn't be too hard to make sure they won't interfere with each other. I ask again: do you have only a single user? Is there the chance that another user might log in (fast user switching)? |
No user switching, each person logs off fully before another logs in. |
Well, that guarantee makes things easier. What I'm thinking now is to have an instance launch on user login, and stay running. Any instances launched after that (e.g. by sched task) notify the persistent instance to start the countdown - and if no such persistent instance exists, then there's no user logged in, so shut down immediately. Of course, this would collapse once you have more than one persistent process - so the single-user guarantee is quite important. Just need to figure out the IPC. |
That sounds like it would work for us perfectly. I wasn't expecting you to put time into resolving the issue just for me. I'm grateful for your assistance. |
You can try the persistent branch. Launch a persistent instance on user login with At any time, run The notification icon now has an Note that the Let me know if there are any issues - I've only done minimal testing at this time. Actually, I'd appreciate it if you could let me know if it works, too. |
Thanks I will test this out on Monday and let you know the outcome. |
Forgive me if I'm being silly, but do you have a download link for the persistent version? |
Hm. Looks like GitHub has removed the downloads section and changed it to releases since I last did something on this. Try here: https://github.com/Elusive138/IdleShutdown/releases/tag/v2.0.0-alpha Do note this is just for testing - I haven't really added any error handling, so the persistent instance will probably just die completely on a crash if you run into a bug. I'll see if I can improve that later, if I have some time - this little program was never really intended for anything major/serious/complex. |
I've now tested this both logged on and off. When logged off the PC shuts down immediately and when logged on the user is prompted to continue or abort the shutdown. I've created the two scheduled tasks for logon and for night time shutdown and it all works perfectly. Thank you so much for the time and effort you've put in to this. |
Hi,
I've been trying to set this up as a scheduled task to shutdown all PC's on our network at a certain time. There are 2 scenarios in the Task Scheduler:
I don't know why the dialog box does not pop up when I set it to scenario 1. Is this a Microsoft issue or something which can be fixed?
The text was updated successfully, but these errors were encountered: