# Net (command)/Localgroup

net is a Windows command used to view and modify network settings. These activities will show you how to use the net localgroup command.
Note: To complete this activity, you must have an administrative user account or the username and password of an administrator account you can enter when prompted.

## Preparation

To prepare for this activity:
* Start Windows.
* Log in if necessary.

## View Local Groups

To view local groups on your computer:
* Open an elevated/administrator command prompt.
* Type net localgroup and press Enter.
* Observe the list of local groups on your computer.

## View Users in a Local Group

To view users in a local group:
* Type net localgroup groupname, where groupname is the name of the group you want to list. For example, if the group name is Administrators, you would type net localgroup Administrators. Then press Enter.
* Observe the list of users in the local group.

## Add a Local Group

To add a local group to your computer:
* Type net localgroup groupname /add, where groupname is the name of the group you want to add. For example, if the group name is Accounting, you would type net localgroup Accounting /add. Then press Enter.
* Type net localgroup and press Enter to confirm the group has been added.

## Add a User to a Local Group

To add a user to a local group:
* Type net user and press Enter to view a list of user accounts on your computer.
* Type net localgroup groupname username /add, where username is the name of the existing user you want to add and groupname is the name of the group you want to add them to. For example, if the group name is Accounting and the username is Bill, you would type net localgroup Accounting Bill /add. Then press Enter.
* Type net localgroup groupname, where groupname is the name of the group you added the user to, and press Enter to confirm the user has been added to the group.

## Add an AzureAD User to a Local Group

To add an AzureAD user to a local group:
* Type net localgroup groupname AzureAD\email /add, where email is the email-address of the existing user you want to add and groupname is the name of the group you want to add them to. For example, if the group name is Administrators and the email is Bill@company.org, you would type net localgroup Administrators AzureAD\Bill@company.org /add. Then press Enter.
* Type net localgroup groupname, where groupname is the name of the group you added the user to, and press Enter to confirm the user has been added to the group.

## Remove a User from a Local Group

To remove a user from a local group:
* Type net localgroup groupname username /delete, where username is the name of the user you want to remove and groupname is the name of the group you want to remove them from. For example, if the group name is Accounting and the username is Bill, you would type net localgroup Accounting Bill /delete. Then press Enter.
* Type net localgroup groupname, where groupname is the name of the group you removed the user from, and press Enter to confirm the user has been removed from the group.

## Remove an AzureAD User from a Local Group

To remove a user from a local group:
* Type net localgroup groupname AzureAD\email /delete, where email is the email-address of the user you want to remove and groupname is the name of the group you want to remove them from. For example, if the group name is Administrators and the email is Bill@company.org, you would type net localgroup Administrators Bill@company.org /delete. Then press Enter.
* Type net localgroup groupname, where groupname is the name of the group you removed the user from, and press Enter to confirm the user has been removed from the group.

## Delete a Local Group

To delete a local group from your computer:
* Type net localgroup and press Enter to view local groups on your computer.
* Type net localgroup groupname /delete, where groupname is the name of the group you wish to delete. For example, if the groupname is Accounting, you would type net localgroup Accounting /delete. Then press Enter.
* Type net localgroup and press Enter to confirm the local group has been deleted.
* Close the command prompt to complete this activity.

## Readings

* Wikipedia: Net localgroup

## references

* Microsoft TechNet: Net localgroup