Jump to content

Help with creating Windows users


 Share

Recommended Posts

I am new at this and want to know if there is a function/s that allow me to create/modify windows users.

There are several ways. The easiest is to use NET USER with the /ADD switch. Open a command line and try this for the syntax:

NET HELP USER

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

There are several ways. The easiest is to use NET USER with the /ADD switch. Open a command line and try this for the syntax:

NET HELP USER

:)

ok i roughly understand the command but how do I use it. I'm very new to autoit so sorry if I'm asking dumb questions. Am I supposed to open command prompt and then using autoit script input the command onto the computer?

Also I don't quite sure how to use the net user command. Say I wanted to add a user to the machine I'm on right now. I'm probably a logged in as an administrator. What would the command be for a user with the following information.

Username= user1

password = (I want to enter the password in manually)

rights = I want it to have limited rights (non administrator)

domain = This computer

usercomment = "firstname lastname"

I know I must sound like such a noob but trust me I've been trying to absorb as much information as I can in the past couple of days. Also if anyone has another suggestion for getting this task done please throw them out there.

Link to comment
Share on other sites

ok i roughly understand the command but how do I use it. I'm very new to autoit so sorry if I'm asking dumb questions. Am I supposed to open command prompt and then using autoit script input the command onto the computer?

Also I don't quite sure how to use the net user command. Say I wanted to add a user to the machine I'm on right now. I'm probably a logged in as an administrator. What would the command be for a user with the following information.

Username= user1

password = (I want to enter the password in manually)

rights = I want it to have limited rights (non administrator)

domain = This computer

usercomment = "firstname lastname"

I know I must sound like such a noob but trust me I've been trying to absorb as much information as I can in the past couple of days. Also if anyone has another suggestion for getting this task done please throw them out there.

AutoIt can run other programs, just like typing them in the Start/Run dialog. The functions are Run(), RunWait(), and ShellExecute(). For you purposes, you might choose RunWait() because it make it easy to check the %ERRORLEVEL% returned by NET.exe for success.

Get a command line worked out that does what you want, i.e. NET USER UserName PassWord /ADD

Now you can run it, saving the return code on exit to see if it worked:

$RET = RunWait('NET USER UserName PassWord /ADD')
If $RET = 0 Then
      MsgBox(64, "Success", "Successfully added user.")
Else
      MsgBox(16, "Error", "Add user failed, returned: " & $RET)
EndIf

Hope that helps!

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

so how could I change the rights of users with Autoit?

Many ways. But the first and simplest is by NET USER and NET LOCALGROUP commands. Learn to create and delete users from the command line with NET USER, then add and remove them from a group with NET LOCALGROUP. A regular user in the Users group that you don't explicitly put in Administrators group seems to be what you wanted.

Once you know how to do it from the command line, you just run those commands in AutoIt via RunWait().

If you want to talk about using the COM interface provided by WMI, or domain accounts... well, that's another show...

:)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...