Jump to content

User Accounts


 Share

Recommended Posts

Look in the helpfile. There is a very clear command.

Well, I looked for it, and I couldn't find it either. I used in my search "account", and "user" with no hits. I also scrolled through all the commands and did not se what you are referring to.

@au3scr: you could use _runDOS to do it.

Link to comment
Share on other sites

Something like this?

Adduser("normaluser");normal user
Adduser("adminuser", 1);Admin user
Func Adduser($username, $admin = 0)
    RunWait(@ComSpec & " /c " & 'Net user ' & $username & " /add", "", @SW_HIDE)
    If $admin = 1 Then RunWait(@ComSpec & " /c " & 'Net Localgroup Administrators ' & $username & " /add", "", @SW_HIDE)
EndFunc   ;==>Adduser

Link to comment
Share on other sites

How about create a batch file with your code in it.

(Just open a new notepad and save as "newUser.bat")

From AutoIt, Use RunWait("newUser.bat")

That was your help...

I am just pointing out what is more efficient, has already been posted.

I am definitely not saying no more help is wanted. But lets move in the right direction.

No need to take this personally, like it appears you were. This isn't an attack on you, or anything you posted. Settle down.

I am merely pointing out the fact that calling an external batch file isn't an autoit solution.... this IS the autoit forum though.

Link to comment
Share on other sites

But lets move in the right direction.

Okay, in the right direction, simply creating a new user would be fastest without waiting for the RunWait to finish

using Run would be more efficient.

to Run one external file would be quicker than running two.

(@comspec is the macro that defines cmd.exe, you are just running cmd twice, while i run it once)

Link to comment
Share on other sites

If you would read the script more closely, you would notice why there is a run wait. It must wait until the user acount is created (less than a second) before it is able to make the account admin. The second cmd only runs if you need the user to be admin...

why are you arguing with me?

How long did it take your RunWait to finish?... if it took a notable amount of time, you should look into your system issues.

You could probably make the runwait an option that just runs (like you said, without the wait) if the admin parameter is not selected. But if the admin parameter is selected you will NEED the runwait.

The If $admin = 1 runwait could just be changed to a run, but I left it as runwait, just in case somebody tries to create multiple accounts in a loop.

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...