Jump to content

Adding Admin Password Via Script


MCT
 Share

Recommended Posts

im trying 2 make a simple script that i can run to simply change the password of my administrator account

1 problem i cant seem 2 figure out

$passwd = InputBox("Please Choose Password", "Enter your password.", "", "")
RunWait(@ComSpec & " /k " & 'net user Administrator $passwd')

the password isnt set to whatever is in the input box , instead its set to $passwd

any help would be appreciated, im wanting 2 as u probly assume set the password via an input box

Link to comment
Share on other sites

im trying 2 make a simple script that i can run to simply change the password of my administrator account

1 problem i cant seem 2 figure out

$passwd = InputBox("Please Choose Password", "Enter your password.", "", "")
RunWait(@ComSpec & " /k " & 'net user Administrator $passwd')

the password isnt set to whatever is in the input box , instead its set to $passwd

any help would be appreciated, im wanting 2 as u probly assume set the password via an input box

<{POST_SNAPBACK}>

try

$passwd = InputBox("Please Choose Password", "Enter your password.", "", "")
RunWait(@ComSpec & " /k " & 'net user Administrator ' & $passwd)
Link to comment
Share on other sites

ive been messing around with the new GUI stuff

ive got a button "Add User" & the username is typed in a text box, so how do i make it when u click the "add user" button it sets whatever's in the input box ($usrname is the variable i use)

#include <GUIConstants.au3>

GUICreate("User Account Creator") ; will create a dialog box that when displayed is centered

GUISetFont(9, 300)

$tab=GUICtrlCreateTab (10,10, 300,200)

$tab0=GUICtrlCreateTabitem ("Add User")
GUICtrlSetState(-1,$GUI_SHOW)  ; will be display first
$tab0OK=GUICtrlCreateLabel ("Username", 20,50,80,50)
$usrname=GUICtrlCreateInput ("Administrator", 90,50,90,20)
$tab0OK=GUICtrlCreateLabel ("Password", 20,80,80,50)
$passwd=GUICtrlCreateInput ("MCT", 90,80,90,20)
$radio1 = GUICtrlCreateRadio ("Yes", 20, 150, 40, 20)
GUICtrlSetState ($radio1,$GUI_CHECKED)
$radio2 = GUICtrlCreateRadio ("No", 60, 150, 40, 20)
$tab0input=GUICtrlCreateLabel ("User is Admin", 20,130,80,20)
$tab0OK=GUICtrlCreateButton ("Add User", 170,150,80,20)

GUICtrlCreateTabitem ("")  ; end tabitem definition

GUISetState ()

Do
    $msg = GUIGetMsg()
    if $msg = $passwd then;i know this section isnt correct
    If $passwd = "" Then
RunWait(@ComSpec & " /k " & 'net user " & $usrname * /add"' )
RunWait(@ComSpec & " /k " & 'net accounts /maxpwage:unlimited' )
;password is blank
Else
RunWait(@ComSpec & " /k " & 'net user " & $usrname $passwd /add"')
RunWait(@ComSpec & " /k " & 'net accounts /maxpwage:unlimited' )
    endif

Until $msg = $GUI_EVENT_CLOSE
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...