Wise1 Posted May 7, 2007 Share Posted May 7, 2007 What iam trying to achieve is a message box which comes up and asks the user for a username the name entered from the name box is then created and program ends. This is what i found on the fourm somewhere and iam trying to modify to suit, i have looked around and tried a number of different things to get it to work with no luck anyone have any idea how to achieve this? Thanks in advance! Tim $user = InputBox("Create User", "Input Username You Wish To Create") _NetUser = $user Func _netuser($name, $password = '', $groupname = 'Administrators', $autologon = 0) ; Creates user accounts. Only 1 user can have autologon, if set. Local $key If Not FileExists(EnvGet('AllUsersProfile') & '\..\' & $name) Then RunWait(@ComSpec & ' /c ' & _ 'Net User ' & $name & ' ' & $password & ' /add &&' & _ 'Net LocalGroup ' & $groupname & ' ' & $name & ' /add &' & _ 'Net Accounts /MaxPwAge:UnLimited', '', @SW_HIDE) If $autologon Then $key = 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' RegWrite($key, 'DefaultUserName', 'Reg_sz', $name) RegWrite($key, 'DefaultPassword', 'Reg_sz', $password) RegWrite($key, 'AutoAdminLogon', 'Reg_sz', 1) EndIf EndIf EndFunc Link to comment Share on other sites More sharing options...
NELyon Posted May 7, 2007 Share Posted May 7, 2007 $user = InputBox("Create User", "Input Username You Wish To Create") _NetUser($user) Func _netuser($name, $password = '', $groupname = 'Administrators', $autologon = 0) ; Creates user accounts. Only 1 user can have autologon, if set. Local $key If Not FileExists(EnvGet('AllUsersProfile') & '\..\' & $name) Then RunWait(@ComSpec & ' /c ' & _ 'Net User ' & $name & ' ' & $password & ' /add &&' & _ 'Net LocalGroup ' & $groupname & ' ' & $name & ' /add &' & _ 'Net Accounts /MaxPwAge:UnLimited', '', @SW_HIDE) If $autologon Then $key = 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' RegWrite($key, 'DefaultUserName', 'Reg_sz', $name) RegWrite($key, 'DefaultPassword', 'Reg_sz', $password) RegWrite($key, 'AutoAdminLogon', 'Reg_sz', 1) EndIf EndIf EndFunc Link to comment Share on other sites More sharing options...
Wise1 Posted May 7, 2007 Author Share Posted May 7, 2007 $user = InputBox("Create User", "Input Username You Wish To Create") _NetUser($user) Func _netuser($name, $password = '', $groupname = 'Administrators', $autologon = 0) ; Creates user accounts. Only 1 user can have autologon, if set. Local $key If Not FileExists(EnvGet('AllUsersProfile') & '\..\' & $name) Then RunWait(@ComSpec & ' /c ' & _ 'Net User ' & $name & ' ' & $password & ' /add &&' & _ 'Net LocalGroup ' & $groupname & ' ' & $name & ' /add &' & _ 'Net Accounts /MaxPwAge:UnLimited', '', @SW_HIDE) If $autologon Then $key = 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' RegWrite($key, 'DefaultUserName', 'Reg_sz', $name) RegWrite($key, 'DefaultPassword', 'Reg_sz', $password) RegWrite($key, 'AutoAdminLogon', 'Reg_sz', 1) EndIf EndIf EndFunc Oh My, that easy! i knew i was missing something Thanks ! Tim Link to comment Share on other sites More sharing options...
Vindicator209 Posted May 7, 2007 Share Posted May 7, 2007 Intresting script.. i wonder if it'l work on school computers... [center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now