Partager via


Net localgroup

 

Applies To: Windows Server 2008, Windows Server 2012, Windows 8

Adds, displays, or modifies local groups. Used without parameters, net localgroup displays the name of the server and the names of local groups on the computer.

Net localgroup is a command-line tool that is built into Windows Vista. To run net localgroup, open a command prompt, type net localgroup with the appropriate parameters, and then press ENTER.

For examples of how to use this command, see Examples.

Syntax

net localgroup [<GroupName> [/comment:"<Text>"]] [/domain]
net localgroup [<GroupName> {/add [/comment:"<Text>"] | /delete} [/domain]
net localgroup [<GroupName> <Name> […] {/add |  /delete} [/domain]

Parameters

  • <GroupName>
    Specifies the name of the local group to add, expand, or delete. Used without additional parameters, **net localgroup <**GroupName> displays a list of users or global groups in a local group.

  • /comment:"<Text>"
    Adds a comment for a new or existing group. The comment can contain up to 256 characters. Enclose the text in quotation marks.

  • /domain
    Performs the operation on the primary domain controller of the current domain. Otherwise, the operation is performed on the local computer.

  • <Name>[ ...]
    Lists one or more user names or group names to add or remove from a local group.

  • /add
    Adds a global group name or user name to a local group. You must first establish an account for users or global groups before you can add it to a local group with this command.

  • /delete
    Removes a group name or user name from a local group.

  • net help <Command>
    Displays help for the specified net command.

Remarks &lt;optional section&gt;

  • Using /domain

    /domain applies only to computers that are members of a domain. By default, server computers perform operations on the primary domain controller.

  • Using Name

    Separate multiple entries with a space. Names can be local users, users on other domains, or global groups, but not other local groups. If a user is from another domain, preface the user name with the domain name (for example, Sales\Ralphr).

  • Grouping users

    Use net localgroup to group users who use the computer or network in the same or similar ways. When you assign rights to a local group, each member of the local group automatically has the same rights.

Examples

The following example displays a list of all the local groups on the local server, type:

net localgroup

The following example adds a local group called Exec to the local user accounts database, type:

net localgroup exec /add

The following example adds a local group called Exec to the domain user accounts database, type:

net localgroup exec /add /domain

The following example adds the existing user accounts stevev, ralphr (from the Sales domain), and jennyt to the Exec local group on the local computer, type:

net localgroup exec stevev sales\ralphr jennyt /add

The following example adds the existing user accounts stevev, ralphr, and jennyt to the Exec group of a domain, type:

net localgroup exec stevev ralphr jennyt /add /domain

The following example displays users in the Exec local group, type:

net localgroup exec

The following example adds a comment to the Exec local group record, type:

net localgroup exec /comment:"The executive staff."

Additional references

Command-Line Syntax Key