Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add users to a group in Windows 2000 1

Status
Not open for further replies.

amitoufu

MIS
Mar 16, 2003
8
US
Hi:

Does any one know how to add domain users/groups to a existing local group in Windows 2000 with command line or script?

Thanks
Chris
 
Yes. I got this from
Net User Sintax:

Adds or modifies user accounts or displays user account information.
net user [username [password | *] [options]] [/domain]
net user username {password | *} /add [options] [/domain]
net user username [/delete] [/domain]
Parameters
none
Used without parameters, net user displays a list of the user accounts on the computer.
username
Specifies the name of the user account to add, delete, modify, or view. The name of the user account can have as many as 20 characters.
password
Assigns or changes a password for the user's account. A password must satisfy the minimum length set with the /minpwlen option of the net accounts command. It can have as many as 127 characters. However, if you're using Windows 2000 on a network that also has computers using Windows 95 or Windows 98, consider using passwords not longer than 14 characters. Windows 95 and Windows 98 support passwords of up to 14 characters. If your password is longer, you may not be able to log on to your network from those computers.
*
Produces a prompt for the password. The password is not displayed when you type it at a password prompt.
/domain
Performs the operation on the primary domain controller of the computer's primary domain.
This parameter applies only to Windows 2000 Professional computers that are members of a Windows 2000 Server domain. By default, Windows 2000 Server computers perform operations on the primary domain controller.
Note
This action is taken on the primary domain controller of the computer's primary domain. This may not be the logged-on domain.
/add
Adds a user account to the user accounts database.
/delete
Removes a user account from the user accounts database.
options
Specifies the following options:
/active:{no | yes}
Enables or disables the user account. If the user account is not active, the user cannot access resources on the computer. The default is yes (active).
/comment:"text"
Provides a descriptive comment about the user's account. This comment can have as many as 48 characters. Enclose the text in quotation marks.
/countrycode:nnn
Uses the operating-system Country/Region codes to implement the specified language files for a user's Help and error messages. A value of 0 signifies the default Country/Region code.
/expires:{date | never}
Causes the user account to expire if date is set; does not ever set a time limit on the user account. Expiration dates can be in mm/dd/yy, dd/mm/yy, or mmm,dd,yy format, depending on the Country/Region code. Note that the account expires at the beginning of the date specified. Months can be a number, spelled out, or abbreviated with three letters. Years can be two or four numbers. Use commas or slashes to separate parts of the date (no spaces). If yy is omitted, the next occurrence of the date (according to your computer's date and time) is assumed. For example, the following date entries are equivalent if entered between Jan. 10, 1994, and Jan. 8, 1995:
jan,9
1/9/95
january,9,1995
1/9
/fullname:"name"
Specifies a user's full name rather than a user name. Enclose the name in quotation marks.
/homedir:path
Sets the path for the user's home directory. The path must exist.
/passwordchg:{yes | no}
Specifies whether users can change their own password. The default is yes.
/passwordreq:{yes | no}
Specifies whether a user account must have a password. The default is yes.
/profilepath:[path]
Sets a path for the user's logon profile. This path points to a registry profile.
/scriptpath:path
Sets a path for the user's logon script. The path value cannot be an absolute path; path is relative to %systemroot%\System32\Repl\Import\Scripts.
/times:{times | all}
Specifies the times the user is allowed to use the computer. The times value is
/times:{times | all}
Specifies the times the user is allowed to use the computer. The times value is expressed as day[-day][,day[-day]] ,time[-time][,time[-time]], limited to 1-hour time increments. Days can be spelled out or abbreviated (M,T,W,Th,F,Sa,Su). Hours can be 12- or 24-hour notation. For 12-hour notation, use AM, PM, or A.M., P.M. The value all means a user can always log on. A null value (blank) means a user can never log on. Separate day and time with commas, and units of day and time with semicolons (for example, M,4AM-5PM;T,1PM-3PM). Do not use spaces when designating times.
/usercomment:"text"
Specifies that an administrator add or change the "User comment" for the account. Enclose the text in quotation marks.
/workstations:{computername[,...] | *}
Lists as many as eight workstations from which a user can log on to the network. Separate multiple entries in the list with commas. If /workstations has no list, or if the list is *, the user can log on from any computer.
Net Computer Sintax:
net computer \\computername [ /add or /del ]
You can use the /add or /delete switch.In the following example the utility adds three new machine accounts to the domain:
net computer \\station1 /add
net computer \\station2 /add
net computer \\station3 /add
You can only apply this utility in a Domain Controller


Glen A. Johnson
"To fear the worst oft cures the worse."
William Shakespeare (1564-1616); English dramatist, poet.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Hi Glen:

Net user is for you to add users to a computer, how do you assign the users to a specific group with command line or script?

Thanks
Chris


 
I know it can be done, but it looks like the writer left it out. Try the
net user username {password | *} /add [options] [/domain]
command, but instead of [options] use [group] and see if that works.

Glen A. Johnson
"To fear the worst oft cures the worse."
William Shakespeare (1564-1616); English dramatist, poet.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Chris,

I recently had to do this to add a group of users to the local admins group on all (W2K) PCs on our domain - the following command worked for me:

Net Localgroup Administrators "dupontsa-uk\locadmins" /Add

note - our domain is 'dupontsa-uk', and the users I wished to add were in the global group 'locadmins', we're still on NT4 domain but should still work fine for you.

HTH

Graham
 
There are a number of ways you can do this....

AS MENTIONED
NET LOCALGROUP /ADD

RESKIT 2000
USRTOGRP.exe - allows you to add users from a text file to a group
GRPCPY - copies members of one group to another

RESKIT 2003
DSQUERY "ou=..,dc=.." USER|DSMOD GROUP groupname - Allows you to query AD and add users to a specifed group depending upon the criteria you specify

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top