Method 1: By using the NET USER command:
FOR /L %i in (1,1,500) DO NET USER MyUser%i /ADD
This will result in creating 500 new users, named MyUser1, MyUser2, etc. You can, of course, customize the FOR command's parameters. See the FOR command help for more options.
You can also set the user's password (in this case - P@ssw0rd) in the same manner:
FOR /L %i in (1,1,500) DO NET USER MyUser%i P@ssw0rd /ADD
You can delete all those users by running the following command:
FOR /L %i in (1,1,500) DO NET USER MyUser%i /DELETE
Note: If run on a stand alone W2K Server, W2K PRO or on an XP machine, this script will create local users. If run on a DC it will create users in the USERS Container in the AD. However, doing so on a domain controller will not create fully AD-compatible users (as you can clearly see if you open one of these users and try to find the User Principal Name - UPN - field).
Note: If you're using a W2K PRO or XP PRO computer that is connected to an Active Directory network and you wish to create local users on that computer - run the command above. However, if you want, from that computer, to create users in the Active Directory database on the DC, use this command instead:
FOR /L %i in (1,1,500) DO NET USER MyUser%i P@ssw0rd /domain /ADD
To create users with pre-configured names (for example - a file with all your company's usernames or a database with usernames) create a text file like this one:
daniel
moshe
yossy
gabi
ran
Name the file USERS.TXT and place it in a directory.
Now open a CMD in that directory and run the following command:
FOR /F %i in (users.txt) DO NET USER %i P@ssw0rd /domain /ADD
This will create user accounts with the names found in the USERS.TXT file, all with the same password - P@ssw0rd. You don't have to use the /domain switch unless you want to.
No comments:
Post a Comment