Sign in to follow this  
Followers 0
Thatsgreat2345

How would I

4 posts in this topic

Ok i have two questions ive tryed winsetstate to hide the cmd but it doesnt seem to be working and im also trying to figure out how i would encorporate a radio button to choose wheter to add an admin account or just add a regular user account + how could i get the current accounts to display in my edit box

to add the account to the admin group the command is

net localgroup "Administrators" USERNAME /add

Example:

net localgroup "Administrators" bob /add

#include <GUIConstants.au3>

; == GUI generated with Koda ==
$Form1 = GUICreate("User Control", 378, 327, 238, 156)
GUICtrlCreateLabel("Delete User", 88, 128, 60, 17)
GUICtrlCreateLabel("Username", 16, 152, 52, 17)
$adduser = GUICtrlCreateInput("", 80, 40, 73, 21, -1, $WS_EX_CLIENTEDGE)
$addpassword = GUICtrlCreateInput("", 80, 72, 73, 21, -1, $WS_EX_CLIENTEDGE)
$Adduserb = GUICtrlCreateButton("Add User", 280, 56, 49, 17)
GUICtrlCreateLabel("Add User", 96, 16, 48, 17)
GUICtrlCreateLabel("Username", 16, 48, 52, 17)
GUICtrlCreateLabel("Password", 16, 80, 50, 17)
$deleteuser = GUICtrlCreateInput("", 80, 152, 73, 21, -1, $WS_EX_CLIENTEDGE)
$Deluserb = GUICtrlCreateButton("Del User", 176, 152, 49, 17)
GUICtrlCreateLabel("Administrator", 176, 48, 64, 17)
$Admin = GUICtrlCreateRadio("Admin", 248, 48, 17, 17)
GUICtrlCreateLabel("Non - Admin", 176, 72, 62, 17)
$Nonadmin = GUICtrlCreateRadio("Admin", 248, 72, 17, 17)
GUICtrlCreateLabel("Change Password", 80, 200, 90, 17)
GUICtrlCreateLabel("Username", 16, 224, 52, 17)
GUICtrlCreateLabel("Password", 16, 256, 50, 17)
$changeuser = GUICtrlCreateInput("", 80, 224, 73, 21, -1, $WS_EX_CLIENTEDGE)
$changepass = GUICtrlCreateInput("", 80, 256, 73, 21, -1, $WS_EX_CLIENTEDGE)
$changepassb = GUICtrlCreateButton("Change", 176, 240, 49, 17)
$Users = GUICtrlCreateEdit("", 248, 120, 113, 201, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetData($Users, "Users")
GUICtrlCreateLabel("Users", 288, 104, 31, 17)
GUISetState(@SW_SHOW)
Do
    
    $msg = GUIGetMsg ()
    Select

Case $msg = $Adduserb 
        $abc = Guictrlread($adduser)
    $ab = Guictrlread($addpassword)
    $Adduserline = ("net user " & $abc & " " & $ab & " /add  /expires:never");Ex: net user bob 123456 /add /expires:never
    Run("C:\WINDOWS\system32\cmd.exe")
    WinSetState("C:\WINDOWS\system32\cmd.exe -","",@SW_HIDE)
    Send($adduserline & "{enter}")
processClose("cmd.exe")

case $msg = $Deluserb
    $a = Guictrlread($deleteuser)
    $deluserline = ("net user " & $a & " /delete");Ex: net user bob /delete 
Run("C:\WINDOWS\system32\cmd.exe")  
send($deluserline & "{enter}")
Processclose("cmd.exe")
case $msg = $changepassb
    $abcd = Guictrlread($changepass)
    $abcde = Guictrlread($changepass)
    $changepassline = ("net user " & $abcd & " " & $abcde);Ex: net user bob 1234 
Run("C:\WINDOWS\system32\cmd.exe")
send($changepassline & "{enter}")
processclose("cmd.exe")
EndSelect
Until $msg = $GUI_EVENT_CLOSE

Share this post


Link to post
Share on other sites



#4 ·  Posted (edited)

why not just

RunWait(@Comspec & ' /c ' & $Adduserline,"", @SW_HIDE)
thx gafrost worked like a charm now for the radio button or the users i know im gonna have to do a regread HKEY_USERS but yeah Edited by thatsgreat2345

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