Commandline option to create local users on Windows Server 2003?

8,480

Solution 1

To expand on Sergey's comment:

The Net command in NT can provide complete local user and group management. You'll need to work with syntax and your intentions, primarily:

  • net accounts
  • net user
  • net localgroup

Sergey's link is good, but these examples may give you more options.

Solution 2

You can use net user command to create users (local or domain) from command line

Solution 3

I would highly recommend investigating powershell 2 for something like this. It goes one step beyond the command-line... it helps you AUTOMATE tedious command-lines. It has powerful utilities that include quick imports of CSV files, and then performing actions on the objects and data contained within that CSV file.

The following is pseudo-code of how it can act:

import-csv | SOME-CREATE-USER-COMMAND

where SOME-CREATE-USER-COMMAND is whatever command you want to use to create users. It is called once for each entry in the CSV file. It has access to the data in the CSV file, and can create users, or run any commands for that matter, making use of fields in the CSV file. This is extremely useful for when you have enough entries that manually typing command-lines becomes tedious and error-prone.

And this is coming from a UNIX guy that just learned PS 2 two weeks ago. I gotta' say - PS2 (powershell 2) is pretty sweet. I think you'll like it for automating tasks such as this.

Solution 4

There are any number of ways. CSVDE or LDIFDE will import users from a CSV or LDIF file. However, "You cannot import user passwords by using csvde"

Share:
8,480

Related videos on Youtube

John M
Author by

John M

Updated on September 18, 2022

Comments

  • John M
    John M over 1 year

    I need to create a number of local accounts on Windows Server 2003. Previously I have created them using the 'Computer Management' gui screen but that method is very tedious and slow.

    Is there a command-line method to create a local user (not active directory)?

    Ideally the command-line method would create username, password from a CSV file.

    UPDATE1:

    Creating a user from the command-line.

    net user myUserName /random /add /comment:"9.13.2011" /expires:never /fullname:"My User Name" /passwordchg:no
    

    Adding that user to 'Remote Desktop Users' group:

    net localgroup "Remote Desktop Users" myUserName /add