Setting up an automatic login in Windows also comes with a great responsibility to safeguard the user account from unauthorized use. After configuring automatic login to your user account, you may also want to set it to lock the workstation immediately at login.
The very reason of setting up automatic login is to avoid typing your credentials or your PIN if you’ve setup one. So, what’s the point of locking the workstation after logging in to your user account?
There are situations where it may be necessary. Many folks do this. Turn on the computer and come back again after a couple of minutes or so. In the meantime, the system would log in to your account, lock the workstation, run all the startup tasks & programs and get things initialized for you. When you come back, just type in your password and start using the system.
Here is another case where this is needed:
Our IT department has begun pushing out periodic Automated Updates overnight which subsequently reboot my workstation. The negative result of this process is my scheduled tasks, which require my network credentials, fail because I am no longer logged into the network when the task is scheduled to run. I leave my workstation logged in and locked (for security) when unattended.
Setting up Automatic Login to Your Account
Press WinKey + R, and type the following and press ENTER:
Uncheck Users must enter a user name and password to use this computer
Click OK. When prompted, type in your user name and password and click OK.
The system is now set to automatically login to your user account. Next step is to create a Scheduled Task to lock the workstation automatically (optional, but more secure).
Automatically Lock Workstation During Logon
Start Task Scheduler, and click "Create Basic Task…" in the Actions pane.
Select "When I log on" in the Task Trigger dialog, and click Next.
In the Action dialog, click "Start a program" and click Next
In the next dialog, type the Program name as: C:\Windows\System32\rundll32.exe
In the "Add arguments" text box, type user32.dll, LockWorkStation
So the command-line that would be executed is:
rundll32 user32.dll, LockWorkStation
The parameter is case-sensitive; Make sure you type exactly as given. Follow the on-screen instructions and finish the procedure.
Now you’ve created a task that locks the workstation immediately after login.
The same command can be run from the Startup folder using a shortcut, but items in the Startup folder are executed very late, which means your desktop would be exposed until the "lock workstation" shortcut kicks in. Whereas when you run it using Task Scheduler, the task is executed immediately after you type in your credentials and login is validated.
There are chances that the task may fail to run at logon, especially if the Scheduler service doesn’t start. As a fallback, you may create a shortcut to the rundll32.exe command-line above and place it in your Startup folder.
The Startup folder your your profile can be accessed by running the following shell: command from Run dialog:
Or by accessing the following folder directly.
The above method(s) won’t provide you fool-proof security, but it’s a far better option than leaving your system unlocked when it’s unattended. If you’re extremely concerned about security, you won’t be using automatic logon in the first place.
One small request: If you liked this post, please share this?One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
- Pin it!
- Share it to your favorite blog + Facebook, Reddit
- Tweet it!
About the author
Ramesh Srinivasan founded Winhelponline.com back in 2005. He is passionate about Microsoft technologies and he has been a Microsoft Most Valuable Professional (MVP) for 10 consecutive years from 2003 to 2012.