Sign in to follow this  
Followers 0
oshaker

Automatic Login

16 posts in this topic

Hi,

I am looking for a script where I can run as a start up script so that it logs in with a specific user and password without requiring users to manually log in, How can I just interact with log in window and enter a username and password while disallowing user interaction and at the same time allow for a special hot key to be pressed. I don't want to use this registry method, rather I need to create a hot key for this script, for example it shows a splash screen counting 5 or 10 seconds and if I press shift key will cancel automatic log in operation and allow me to log in using other credentials.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi.

Edit: Welcome to the Forum!

Hi,

I am looking for a script where I can run as a start up script so that it logs in with a specific user and password without requiring users to manually log in,... .

Use Autolog.exe

It's command line capable, call it from a compiled autoit script to hide user/password.

FileInstall() might be usefull.

And, yes, it's working fine without Novell Client for Netware :)

Regards, Rudi.

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

I looked at it. Will try it tomorrow and get back to you, thanks alot, and really happy to be a member here in the AutoIT forum :)

Share this post


Link to post
Share on other sites

Perfect !

It's working, finally!

RunAsWait("Administrator", "DomainName", "Password", 0, "Autolog.exe /U /MSDom:bau /MSUsr:DomainUser /MSPass:password /Mode:1")

Thanks a lot :)

Share this post


Link to post
Share on other sites

Perfect !

It's working, finally!

RunAsWait("Administrator", "DomainName", "Password", 0, "Autolog.exe /U /MSDom:bau /MSUsr:DomainUser /MSPass:password /Mode:1")

Thanks a lot :)

Glad to help. Have fun, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

For a completely AutoIT solution you could try

Func AutoLogon($username, $userPassword = "");Write autologon information to registry
    Local $tempRegkey = "HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\"
    RegWrite($tempRegkey, "DefaultUserName", "REG_SZ", $username)
    RegWrite($tempRegkey, "DefaultPassword", "REG_SZ", $userPassword)
    RegWrite($tempRegkey, "AutoAdminLogon", "REG_SZ", "1")
    RegWrite($tempRegkey, "AutoLogonCount", "REG_DWORD", 1)
    RegWrite($tempRegkey, "DefaultDomainName", "REG_SZ", @LogonDomain)
EndFunc  ;==>AutoLogon

Func AutoLogonreset();Clear autologon
    RegWrite("HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\", "AutoAdminLogon", "REG_SZ", 0)
EndFunc  ;==>AutoLogonreset

Have Fun

John Morrison

Share this post


Link to post
Share on other sites

Hi.

When setting that stuff "by hand", for the AutoLogonreset() add a line to delete (the clear text) password stored in the Registry:

$LogonKey = "HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\"
Func AutoLogonreset();Clear autologon
    RegWrite($LogonKey, "AutoAdminLogon", "REG_SZ", 0)
    RegWrite($Logonkey, "DefaultPassword", "REG_SZ", "")
EndFunc  ;==>AutoLogonreset

That's a point autolog.exe takes care of, when started to disable autologon.

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

Hi.

When setting that stuff "by hand", for the AutoLogonreset() add a line to delete (the clear text) password stored in the Registry:

$LogonKey = "HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\"
Func AutoLogonreset();Clear autologon
    RegWrite($LogonKey, "AutoAdminLogon", "REG_SZ", 0)
    RegWrite($Logonkey, "DefaultPassword", "REG_SZ", "")
EndFunc  ;==>AutoLogonreset

Does autolog.exe do anything else? I prefer native functions so that no extra baggage that is needed to run the script.

Have fun!

John Morrison

Share this post


Link to post
Share on other sites

I did this using TweakUI..

Go to Logon, and click Autologon. Turn the "Log on automatically at..." option on and type your username + password.

Mdiesel

Share this post


Link to post
Share on other sites

I did this using TweakUI..

Go to Logon, and click Autologon. Turn the "Log on automatically at..." option on and type your username + password.

Mdiesel

Yep and another manual method is to click run type "Control userpasswords2" and click OK.

John Morrison

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

For a completely AutoIT solution you could try

 

Func AutoLogon($username, $userPassword = "");Write autologon information to registry
    Local $tempRegkey = "HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\"
    RegWrite($tempRegkey, "DefaultUserName", "REG_SZ", $username)
    RegWrite($tempRegkey, "DefaultPassword", "REG_SZ", $userPassword)
    RegWrite($tempRegkey, "AutoAdminLogon", "REG_SZ", "1")
    RegWrite($tempRegkey, "AutoLogonCount", "REG_DWORD", 1)
    RegWrite($tempRegkey, "DefaultDomainName", "REG_SZ", @LogonDomain)
EndFunc  ;==>AutoLogon

Func AutoLogonreset();Clear autologon
    RegWrite("HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\", "AutoAdminLogon", "REG_SZ", 0)
EndFunc  ;==>AutoLogonreset
Have Fun

John Morrison

 

 

Does your "AutoLogon" function cause the machine to log in when the function is called, or does it set credentials to automatically log in next time the machine is rebooted?

I'm trying to use it to allow my application to run on a server as if somebody has logged in already, to work around the issue here: https://forums.aws.amazon.com/message.jspa?messageID=481709#481709

Edited by adamchapman

Share this post


Link to post
Share on other sites

Does your "AutoLogon" function cause the machine to log in when the function is called, or does it set credentials to automatically log in next time the machine is rebooted?

I'm trying to use it to allow my application to run on a server as if somebody has logged in already, to work around the issue here: https://forums.aws.amazon.com/message.jspa?messageID=481709#481709

It sets the credentials so that the computer will automatically log in to the specified user when when it's started.

I'd suggest your option 3 with this script may solve your problem.

Good Luck!

John Morrison

Share this post


Link to post
Share on other sites

Thanks for the fast response John, 

 

Unfortunately I've had no luck so far... 

 

I've tried your method by running your "Autologon" function, then restarting the server. If it worked I expected to see icons for the programs in my startup folder in the task bar when I login manually (with rdp)  10 minutes after restarting ( I figure 10 minutes is plenty of time for these programs to initiate).

 

 Next I setup task scheduler to run a compiled version of rudi's 

RunAsWait("Administrator", "DomainName", "Password", 0, "Autolog.exe /U /MSDom:bau /MSUsr:DomainUser /MSPass:password /Mode:1")

method. Again logging in manually the startup folder programs had not been initiated by the time I arrived.

 

I wonder if it is logging in automatically with both methods, but still not running anything from the startup folder, although I have no idea how to check  :ermm:

Share this post


Link to post
Share on other sites

What should have happened is the computer should have automatically logged on. 

Exactly as if you manually logged in.

I haven't looked at this script for a long time but it still should work.

I can't test it as I have some stuff running on my computer that cant' be interrupted so I can't test it.

What version of windows are you running?

Have you checked that the registry keys were set/changed?

Have you tried to run the script containing my functions "as admin?

Let me know and we'll see where we can go from here. :)

Good Luck

John Morrison

Share this post


Link to post
Share on other sites

Sorry for the late reply - I noticed that the string"HKLMSoftwareMicrosoftWindows NTCurrentVersionWinLogon"

I had to be changed to "HKEY_LOCAL_MACHINE...) and tried that a few times. I checked the registry each time but no DefautUserName was ever visible. 

I've started using Shawn Remerdes' solution from https://forums.aws.amazon.com/thread.jspa?messageID=315613 . 

It's working fine today and I think it is a bit more secure too, as the "autologon" program he mentions also encrypts the username and password in the registry.

Thanks for your help storme, I really appreciate the time you put in but I've found a solution that works for me now. 

For anybody reading this in the future:

Share this post


Link to post
Share on other sites

Yep I remember seeing that program.  It came out a few years after the little script of mine.

If you check out the reg keys I used I think you'll find that program is writing the same keys.  Though I maybe wrong. :)

Yes the plain text was a problem, always has been.  If you found what the encryption was used that would be solved as well.

It's academic now.  However....

I think your problem was probably just security.  Probably you script didn't have enough permission to change those reg keys.

Anyway glad you found a solution that suits you.  That is the aim of the game after all.

Onward and upward!

John Morrison

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0