Setting up an Idle Restart Task

Anonymous
2024-11-11T16:21:48+00:00

I work at a public library and am trying to set up our public computers to restart when they are left idle for 10-15 minutes. Ostensibly this is straightforward, I can add a task in Task Scheduler which executes shutdown /r after it detects the computer has been idle for 15 minutes, but the issue is that these computers are also set up to autologin to the User standard account, so if the task starts running on login, it will just keep restarting every 15 minutes indefinitely until someone happens to start using it. It's important that the account not have a password.

One idea I had was to try to get the computer to boot to the login screen, where the User account is preselected and they just have to click "login" to finish logging in, which is what happens when I log out of User and it goes back to that screen, but if the User account was the last used, Windows will always automatically finish login on that device when it starts up, regardless of any registry settings I change. I'm actually probably ok with this because there's also an Admin account that I don't want them even seeing is on the device and trying to log into.

I also have tried writing a PowerShell script that detects the last activity of a user using the GetLastInputInfo API, but after that didn't work I looked around online and found that apparently this function does not work at all if auto login is being used, which was irritating, but whatever.

Currently the best solution I have found is requiring Ctrl+Alt+Del on startup, and when that is pressed the User account will finish auto login. I am worried that people (and therefore my superiors at the library) will not like this because it's new and many of our patrons will have a hard time figuring out what to do, even if it says it on the screen. Not trying to judge anyone, just being realistic.

Is there any other obvious solution I'm missing, or are there any other strategies I could use to accomplish this?

***Move from Windows / Windows 11 / Sleep and Power on, off***

Windows for business Windows Client for IT Pros Performance Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question. To protect privacy, user profiles for migrated questions are anonymized.

0 comments No comments
{count} votes
Accepted answer
  1. Anonymous
    2024-11-12T17:14:44+00:00

    Hello

    Thank you for posting in Microsoft Community forum.

    It sounds like you've put a lot of thought into this! Here are a few alternative strategies that might help you achieve your goal without causing too much confusion for your patrons:

    Use a Scheduled Task with Conditions:

    You can create a scheduled task that only triggers the restart if the computer has been idle for a certain period and the user is logged in. This way, the task won't run immediately upon login. In Task Scheduler, you can set conditions under the "Conditions" tab to ensure the task only runs if the computer is idle for a specified time.

    Implement a Custom Idle Detection Script:

    Instead of relying on GetLastInputInfo, you could use a more robust script that checks for user activity. For example, you can use a combination of PowerShell and Task Scheduler to monitor user activity and trigger a restart only if the computer has been idle for the desired period. Here’s a basic example:

    $idleTime = 15 * 60 # 15 minutes in seconds

    $lastInput = [System.Environment]::TickCount

    while ($true) {

    *$currentInput = [System.Environment]::TickCount* 
    
    *if (($currentInput - $lastInput) -gt $idleTime \* 1000) {* 
    
        *shutdown.exe /r /f /t 0* 
    
    *}* 
    
    *Start-Sleep -Seconds 60* 
    

    }

    This script checks for idle time and restarts the computer if it exceeds 15 minutes.

    Use Group Policy to Enforce Idle Timeout:

    If your library computers are part of a domain, you can use Group Policy to enforce an idle timeout. This can be configured to log off the user or restart the computer after a specified period of inactivity.

    Third-Party Software:

    There are third-party tools designed to manage public computers, which often include features for handling idle time and automatic restarts. These tools can provide more flexibility and ease of use compared to built-in Windows tools.

    Educate Users:

    If you decide to go with the Ctrl+Alt+Del method, consider creating clear, simple instructions and placing them prominently near the computers. This can help users understand the new process and reduce confusion.

    Each of these methods has its pros and cons, so you might need to experiment a bit to find the best fit for your library's needs.

    Best Regards,

    Wesley Li

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful