How can I make Windows ask for user credential on login only on specific days, or any other time range?

Inspired by this question only for linux, it give me the same idea because I have similar problem.

  • Ask upon login? For UAC? In which situations exactly?
    – slhck
    Dec 16, 2014 at 12:34
  • I am not aware of any authentication system that works with Windows that would allow this. What you can do is make the authentication easier but actually require it more often. For instance a smart card can allow you to do it with a short pin that is require each time the computer is locked. You can also do biometrics which is built into Windows 8.0 and later.
    – Ramhound
    Dec 16, 2014 at 12:35

1 Answer 1


I love making ugly hacks to achieve things in Windows, so here's a possible solution :) I haven't tested it, but it sounds possible.

1 - Enable automatic login

See this article on SuperUser for setting up automatic login in Windows 7. It involves changes in the registry, so be sure to make a backup first. - Also please note, your user must have set a password for the next steps to work.

2 - Create a .bat script for locking the computer

Open Notepad and type in the following:

rundll32.exe user32.dll, LockWorkStation

Save it as LockDesktop.bat (name doesn't matter, just an example).

Please note: if it gets saved as LockDesktop.bat.txt, you must disable hiding file extensions so you can rename it properly to .bat. Open Windows Explorer, press the Alt button, click Tools -> Folder options -> Switch to the View tab -> unmark Hide extensions for known file types -> click OK. Now you should be able to rename it properly to LockDesktop.bat

3 - Make a Task for automating the lockdown

  • Open Task Scheduler

  • Create Basic Task

  • Type "LockDesktop" in the name

  • Choose your preferred method for triggering the task, for example daily

  • Make necessary changes depending on your previous method for triggering, or leave empty

  • Pick Start a program

  • In the Program/script: text field, enter the path to your bat file. For example C:\LockDesktop.bat

  • Finish

Everytime the task runs, it will run the bat file which basically locks your computer. You will then have to press CTRL+ALT+DEL and enter password to log back in.

Let me know how it goes :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .