Jump to content
Sign in to follow this  
Wise1

Create user Via Input Box

Recommended Posts

Wise1

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

Share this post


Link to post
Share on other sites
NELyon

$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

:)

Share this post


Link to post
Share on other sites
Wise1

$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 :D

Thanks !

Tim

Share this post


Link to post
Share on other sites
Vindicator209

Intresting script.. i wonder if it'l work on school computers... :):D

:D


[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]

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.