How to lock Windows PC after automatic login

On Windows, automatic log-in is handy because you can launch the PC program when it starts. You can even let your PC boot automatically at specific times. To improve security, you can let Windows 10 automatically lock and ask for a password after you sign in automatically.

How to lock Windows PC after automatic login

With auto-lock at sign-in, your PC will automatically log in, launch and start the program on boot - but it'll lock itself and you'll have to enter your password to use it. This is not as secure as avoiding automatic login, as your user account password will still be stored and entered automatically by the system, but it's better than having your PC start up and provision it automatically. an unrestricted desktop.

To do this, all you have to do is let Windows run the command after it's logged in:

rundll32.exe user32.dll, LockWorkStation

This command will lock the system. It accomplishes the same function as pressing Windows + L . There are several ways to get Windows to run it when logged in, including in Group Policy. The easiest way, however, is to simply add a key shortcut to your Startup folder .

I did this process on Windows 10, but it should also work on older versions of Windows, including Windows 8 and Windows 7.

Create key shortcuts

First, open the Startup folder. To do so, press Windows + R to open a Run dialog box , type the following line and press Enter :

shell:startup

In the Startup folder , right-click and choose New> Shortcut .

Picture 1 of How to lock Windows PC after automatic login Create a new shortcut

In the Create Shortcut dialog box , copy and paste (or type) the following command:

rundll32.exe user32.dll, LockWorkStation

Click Next to continue.

Picture 2 of How to lock Windows PC after automatic login Click Next to continue

Name the shortcut whatever you like - for example, ' Lock Computer '.

Picture 3 of How to lock Windows PC after automatic login Name the shortcut

All operations are completed!

If you double-click the created shortcut, Windows will lock the computer. You will then have to sign in with your password, PIN or any other login method you use.

When you log in to your PC, Windows launches this shortcut along with other startup programs and automatically locks your PC. After you unlock it, you should be able to do everything on the machine as you normally would.

To undo the change, just reopen the shell: startup folder and delete the Lock Computer shortcut you created.

lock Windows PC

ncG1vNJzZmismaXArq3KnmWcp51ktbDDjK2mZqSfmLhuw8inm6ivo2K9pHnAn6ueql2WwrW7zJqroptdobyotc0%3D