# [Tip] Automatic Login to Windows and Instantly lock the computer.



## newtekie1 (Aug 2, 2010)

*Problem:*  You like to leave XYZ program running 24/7, but XYZ program only starts when you log into the computer(XYZ can be whatever program you want).  So when automatic updates hit and auto-restart your computer, the XYZ program doesn't start back up.  You could not put a password on your user account, so the computer automatically logs onto your user account when it reboots, but that is insecure, and if you have nosy roommates/children/super intelligent monkeys, if there is no password they might get on your computer and find your huge collection of por...legally obtained songs...
	

	
	
		
		

		
			





*Solution:* Set Windows to automatically log into a password protected user account, and then instantly lock the computer.  Here's how:


I'm going to assume you already have your user account password protected.  If not, setup a password for your user account now...I'll wait...ok, moving on.
In the _Run_ dialog type "control userpasswords2" without quotes. Then press _OK_.




In the _User Accounts_ window uncheck the box for "Users must enter a password to use this computer." Press _OK_.




In the _Automatically Log On_ window enter your username and password. Press _OK_.




Open _Notepad_ and type "rundll32.exe user32.dll, LockWorkstation" without quotes.




Save the text document as lock.bat.  Make sure you change _Save as type:_ from *.txt to *.*!




Drag lock.bat into your _Startup_ folder.





That is it.  Now when the computer is rebooted it will automatically log in to your account, load any programs you want started, and lock the computer so a password is still required to use it.

A few notes:

If you change the password for your user account, it will break the auto login.  You will have to go back into control userpasswords2 and re-enter your login information.
This should work with any recent version of Windows, I've tested it back to at least XP. You shouldn't be using anything older than that anyway.
I've tested this with Win7 and Vista Home Premium and up.  It should work on Home Basic and Starter as well, and it should work on XP Home, but I haven't tested this personally.  The lower versions of Windows might not have the Control Userpasswords2 ability.
This works with Server versions of Windows also.


----------



## burtram (Aug 2, 2010)

This is great. I will have to use this in the future.


----------



## ebolamonkey3 (Aug 2, 2010)

Awesome, thank you for sharing!


----------



## newtekie1 (Aug 3, 2010)

I'm going to bump this for the evening crowd.


----------



## FordGT90Concept (Aug 3, 2010)

Wouldn't it be better to add rundll32.exe user32.dll, LockWorkstation to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run?  Maybe use HKEY_CURRENT_USER instead of HKEY_LOCAL_MACHINE.


----------



## AphexDreamer (Aug 3, 2010)

Kool all I wanted to do is use the auto login feature. Its sooo anoyying typing in your password every boot. I only have a password so I can use SMP Client for Folding at home. 

Thanks again!


----------



## JrRacinFan (Aug 3, 2010)

This would work GREAT with those persons who use afterburner on an admin account along with multiple standard users on a single PC. Be a little workaround


----------



## newtekie1 (Aug 3, 2010)

FordGT90Concept said:


> Wouldn't it be better to add rundll32.exe user32.dll, LockWorkstation to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run?  Maybe use HKEY_CURRENT_USER instead of HKEY_LOCAL_MACHINE.



I don't think it matters how you do it.  I just do it via a bat file and the startup folder because editting the registry is off-putting to some people, and it is easier to remember where it goes and easier to reverse(just deleted the file from startup).


----------



## n-ster (Aug 3, 2010)

While I knew this since quite a while, good job on the quick n easy TUT

This way is the best for the average user


----------



## FordGT90Concept (Aug 3, 2010)

newtekie1 said:


> I don't think it matters how you do it.  I just do it via a bat file and the startup folder because editting the registry is off-putting to some people, and it is easier to remember where it goes and easier to reverse(just deleted the file from startup).


Just make a .reg file to run.  You can make a .reg file to remove the added key as well. XD


----------



## OneMoar (Aug 3, 2010)

batchh files are pro


----------

