Timed Logout

From DN Wiki
Jump to navigation Jump to search


We've started using laptops as troubleshooting jump boxes. We can plug them into the wired network and then RDP to them so we can troubleshoot wireless in another office. One problem with Windows is that only a single user can log in at a time and you can't kick them out. They have to log out or someone has to reboot the box if they forget to logoff.

Put this batch file in All Users Startup and Desktop as a workaround.

Batch File

 @ECHO off
 echo When this timer expires you'll be logged out.
 echo You can Ctrl+C or close the window to stop the batch file but don't forget to logoff or you lock everyone else out.
 echo =======================
 @REM Timeout pauses until the timer expires in 3600 seconds. 
 @REM   It can normally be skipped by hitting any key but that would log you off NOW so /nobreak prevents that.
 timeout /t 3600 /nobreak
 @REM Logs you off.  Shutdown /r (reboot) can use the same /t timer as timeout but sadly it doesn't work with /l.
 shutdown /l