Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a power management setting (set up through the Control Panel) that turns the monitor off after 5 minutes of idling but keeps the power on all time, if the laptop is connected to power. Under this setting, however, the computer doesn't lock itself and becomes vulnerable to any passerby's attempt to log in if I'm not around.

Is there any way to force lock in this situation? (I can force lock if I have the laptop go sleep, but for immediate access I'd like to keep the power on when the laptop is connected to power.)

share|improve this question

3 Answers 3

up vote 3 down vote accepted

Lock Windows using Windows logo keyL when you walk away from the computer...Done!

share|improve this answer
    
That's even better. I don't have to put the computer to sleep (which wreaks havoc with internet connection, which is a well-known issue) or wait for the screen saver to kick in. Thanks! –  Anon Jul 4 '13 at 22:37

You can use the screensaver that can only be turned off with a password:

  • On the Start menu, click Control Panel.
  • Click Display, and then click Screen Saver.
  • In the Wait box, choose 5 minutes
  • Click On resume, password protect, and then click OK.
share|improve this answer
    
I have the screensaver. But the funny thing is, when the monitor goes off based on the power management setting, the screensaver stops, which means the password protection under screensaver is also removed. –  Anon Jul 3 '13 at 11:18
    
@Anon - My guess is that you don't have the screensaver set to lock the computer. –  Daniel R Hicks Jul 3 '13 at 11:21
    
@ Daniel, you were absolutely right. The screensaver didn't have the lock on. –  Anon Jul 4 '13 at 22:36

For that purpose I've created small AutoIt script. It works in loop, periodically cheking the _Timer_GetIdleTime() function value from Timers.au3, if it becomes greater than certain amount of time, the script executes tsdiscon.exe, and PC exits to welcome screen.

Here is the code I have used:

#include <Timers.au3>

const $setpoint = 900000 ; switch by idle time setpoint 900000 ms = 15 minutes
const $interval = 60000 ; check interval 60000 ms = 1 minute
const $tsdisconpath = "C:\WINDOWS\System32\tsdiscon.exe" ; specify the actual path for your OS, this might need to be changed
; eg on my Win 7 HB x64 the file full path is C:\WINDOWS\winsxs\amd64_microsoft-windows-t..es-commandlinetools_31bf3856ad364e35_6.1.7601.17514_none_42d65ed50fa3c682\tsdiscon.exe

$disconnected = false
$idle = 0
while true
    $prev = $idle
    $idle = _Timer_GetIdleTime()
    if $disconnected and $prev > $idle then ; user has logged in again
        $disconnected = false ; reset state
    endif
    if $idle > $setpoint and not $disconnected then
        run($tsdisconpath, "") ; exit to welcome screen
        sleep(10000)
        $disconnected = true
        $idle = 0
    endif
    sleep($interval)
wend

You have to specify the actual path to the file tsdiscon.exe for your OS. I compiled this code to exe with Aut2Exe (it available both in full install and portable AutoIt), and put to autorun. AutoIt version was 3.3.8.1.

share|improve this answer
    
@FranciscoTapia, IMO my answer answers exactly the asked question, what's wrong? –  omegastripes yesterday
1  
well, if you post an answer It should be seen as an answer, if i face that trouble, your answer would not give me any help, look the other answer. it haves a coomprensible step by step guide to solve the OP. –  Francisco Tapia yesterday
    
@omegastripes if you are suggesting AutoIt as an answer it would be useful if you could post the relevant script here and instructions on how to use it so that it benefits future users. –  Mokubai yesterday
    
there is it. :) –  Francisco Tapia 20 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.