How to automatically lock Windows 7 after configurable time without using Windows Screen saver

Posted on 2011-04-26
Last Modified: 2012-05-11
I have a user that is using a fax program that needs to disable the Windows 7 Screen saver (too CPU intensive and will starve comm. threads for fax receive they say).  Fax program works great other than this and do not want to change this program.

Also, the fax program will not work if you log off the computer.  You are only allowed to use the Windows "Lock" for security.

The issue is the user wants to have an automatic way to lock the Windows 7 computer (after 30 minutes for example).  They are using manual Start -> Shutdown -> Lock method now but need automatic method.

Is there a way to do this natively in Windows 7?  If not, is there a good free or inexpensive paid program to do this?

Question by:rdwolf
    LVL 3

    Expert Comment

    There is a simple way to do this without installing anything. You can do this by holding the Windows key and pressing the L key. This will immediately lock the computer.

    Author Comment


    The need is to do this automically  when the user steps away from desk for greater than 30 minutes. They already know how to do manual method.

    So I am still looking for an automatic locking method as stated.

    LVL 9

    Accepted Solution

    LVL 13

    Expert Comment

    Here is a locking exe i wrote in autoit, which is a freeware program you can get here
    I have included the pre-compiled exe, an ini file, and the source code which you can compile yourself if you don't want to run my exe.
    The exe and the ini file need to be in the same directory. The program defaults to lock at  15 minutes which is 900,000 MS
    If you want the computer to autolock at 30 minutes set the "time = " section in the ini file to 3,600,000
    This program will also create a shortcut in the %username%\startup folder so that it will persist across reboots.
    It will work with win 7 and xp.
    If you want to kill the program hitting the ESC will shut it down.

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    Opt("TrayIconHide", 1)
    #include <Timers.au3>
    $IdleMinimum  = IniRead(@ScriptDir & "\time.ini", "time", "time", "")
    HotKeySet("{ESC}", "_Quit")
    if $IdleMinimum  = "" then $IdleMinimum = 900000; Idle time in milliseconds
    case	@OSVersion  = "WIN_7"
    if not FileExists("C:\Users\" & @UserName & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\lock.lnk")Then
    FileCreateShortcut(@scriptdir & "\lock.exe","C:\Users\" & @UserName & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\lock.lnk",@scriptdir)
    case    @OSVersion  = "WIN_XP"
    if not FileExists("C:\Documents and Settings\" & @username & "\Start Menu\Programs\Startup\lock.lnk") Then
    FileCreateShortcut(@scriptdir & "\lock.exe","C:\Users\" & @UserName & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\lock.lnk",@scriptdir)
    While 1
        If _Timer_GetIdleTime() >= $IdleMinimum Then
    		Run(@COMSPEC  & " /c" & " rundll32.exe user32.dll, LockWorkStation","",@SW_HIDE)
            Until _Timer_GetIdleTime() < $IdleMinimum
    Func _Quit()
    EndFunc  ;==>_Quit

    Open in new window


    Author Closing Comment

    Thanks for the solution.

    I actually ended up just using the Windows 7 screen saver with lock.  I tuned off the screen saver so the computer will lock, after specified time, and now screen saver will come up using CPU cycles that the Fax program can not work with for receive fax queues.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    By now, it is common knowledge that Windows 7 has been successfully been able to live up to the hype of being touted as Microsoft’s most anticipated O.S. ever. This latest 2010 Windows release builds up on its predecessor’s positives, adding new…
    The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
    This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
    This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now