Sign in to follow this  
Followers 0
firman

auto logon a user that....

8 posts in this topic

I want to auto logon a user that has never logged onto a computer before....meaning that this loging will be the one that sets up their initial profile.

Now what I have is:

$user_file = FileOpen("c:\user_data.dat", 0)

$username = FileReadLine($user_file , 1)

$password = FileReadLine($user_file , 2)

;"Automatic Local USER Logon"

;Write the REG_SZ value of "DefaultUserName"

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultUserName", "REG_SZ", $username)

; Write the REG_SZ value of "DefaultUserName"

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AltDefaultUserName", "REG_SZ", $username)

; Write the REG_SZ value of " ALT DOMAIN"

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultDomainName", "REG_SZ", "AMER")

; Write the REG_SZ value of "PASSWORD"

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword", "REG_SZ", $password)

; Write the REG_SZ value of "Automatic Logon"

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoAdminLogon", "REG_SZ", "1")

; Write the REG_SZ value of " ALT OMAIN"

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AltDefaultDomainName", "REG_SZ", "AMER")

FileClose($user_file)

This is so that when the computer restarts this information is in the registry... This works fine when I have this on a computer that a user has already logged into atleast once... But does not work when this is the first time the user is logging in...

Anyone have any fixes for this issue???

Share this post


Link to post
Share on other sites



Does anyone have any input on this?

Share this post


Link to post
Share on other sites

Leme get this straight, you want the user to have to enter/change their password when they logon, might want to check this out, %SystemRoot%\system32\compmgmt.msc /s

>Local Users and Groups

>>Users

(Not all options are there in windoes xp home.)


[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Share this post


Link to post
Share on other sites

Leme get this straight, you want the user to have to enter/change their password when they logon, might want to check this out, %SystemRoot%\system32\compmgmt.msc /s

>Local Users and Groups

>>Users

(Not all options are there in windoes xp home.)

No... I will already have there password and username in the registry and I have it set to auto login..... The problem is.... I am trying to have it login a name from my domain, that has NEVER logged on to this computer before.... My code above works if the person has already logged in to the computer at a previous time. The code DOES NOT WORK....when this is the first time this username is logging in to this computer

Share this post


Link to post
Share on other sites

No... I will already have there password and username in the registry and I have it set to auto login..... The problem is.... I am trying to have it login a name from my domain, that has NEVER logged on to this computer before.... My code above works if the person has already logged in to the computer at a previous time. The code DOES NOT WORK....when this is the first time this username is logging in to this computer

This script will start out by asking for the username ane password you want to login under. Then lauches the password controler, unchecking the box requiring the user to enter a name and password (assuming you are required to now). It will then enter the name and password you provided, ok everything, then reboot. When the system comes back up, it will automatically login as the user you entered. This will not work if the machine is a member of a domain. Afterwards, if you want to have the machine require a login, go to Start, Run and type "control userpasswords2" and recheck the box.

$username = InputBox("Username", "Enter the username.", "", "", 190, 115 )

Sleep(500)

$password = InputBox("Password", "Enter the password.", "", "", 190, 115 )

Run(@ComSpec & " /c " & 'control userpasswords2', "", @SW_HIDE)

WinWaitActive ("User Accounts", "Users must &enter a user name and password to use this computer.")

Send("!e" & "!a")

WinWaitActive ("Automatically Log On")

Send("!u" & $username & "!p" & $password & "!c" & $password & "{ENTER}")

WinWaitActive ("User Accounts")

Send("{ENTER}")

Shutdown ( 2 )

Auto_Login.au3

Share this post


Link to post
Share on other sites

This script will start out by asking for the username ane password you want to login under. Then lauches the password controler, unchecking the box requiring the user to enter a name and password (assuming you are required to now). It will then enter the name and password you provided, ok everything, then reboot. When the system comes back up, it will automatically login as the user you entered. This will not work if the machine is a member of a domain. Afterwards, if you want to have the machine require a login, go to Start, Run and type "control userpasswords2" and recheck the box.

$username = InputBox("Username", "Enter the username.", "", "", 190, 115 )

Sleep(500)

$password = InputBox("Password", "Enter the password.", "", "", 190, 115 )

Run(@ComSpec & " /c " & 'control userpasswords2', "", @SW_HIDE)

WinWaitActive ("User Accounts", "Users must &enter a user name and password to use this computer.")

Send("!e" & "!a")

WinWaitActive ("Automatically Log On")

Send("!u" & $username & "!p" & $password & "!c" & $password & "{ENTER}")

WinWaitActive ("User Accounts")

Send("{ENTER}")

Shutdown ( 2 )

The computer is a member of a domain... and so is the USER ACCOUNT.....

I am trying to login a domain user account to this computer for the first time... There has to be a registry setting to let this be done I believe..... My code at the beggining of this post works for users who already have a PROFILE setup on the computer....just not for someone NEW logging in.

Share this post


Link to post
Share on other sites

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Share this post


Link to post
Share on other sites

I am sorry....but NOBODY is understanding that this is a DOMAIN USER ACCOUNT!!!!. I need this to work while a computer is on the DOMAIN... and the USER has a password... As I have stated... my code at the begging does work!.... Just not for a FIRST TIME LOGON....

Does anyone have anymore input on this situation?

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