Windows cmd user groups

Описание команды NET LOCALGROUP

Команда NET LOCALGROUP преназначена для добавления, отображения и изменения локальных групп компьютера в операционной системе Windows. Ввод команды NET LOCALGROUP без параметров выводит имя сервера и имена локальных групп компьютера.

Для управления учетными записями пользователей используется команда NET USER , а для управления учетныеми данными пользователей NET ACCOUNTS.

Синтакис команды NET LOCALGROUP

net localgroup [имя_группы [/comment:»текст»]] [/domain]

net localgroup [имя_группы [/domain]]

net localgroup [имя_группы имя [ . ] [/domain]], где

  • имя_группы — Имя локальной группы для добавления, удаления или раскрытия. При запуске команды net localgroup имя_группы без дополнительных параметров выводится список пользователей или глобальных групп, входящих в локальную группу.
  • /comment:»текст» — Добавление комментария для новой или существующей группы. Длина комментария может составлять до 48 знаков. Текст следует заключать в кавычки.
  • /domain — Выполнении операции на основном контроллере текущего домена. В противном случае операция осуществляется на локальном компьютере.
  • имя [ . ] — Список из одного или нескольких имен пользователей или групп для добавления или удаления из локальной группы.
  • /add — Добавление глобальной группы или пользователя в локальную группу. Для пользователей или глобальных групп группы, добавляемых в локальную группу, должны иметься учетные записи.
  • /delete — Удаление группы или пользователя из локальной группы.
  • net help localgroup —Отображение справки для указанной команды net.

Примеры команды NET LOCALGROUP

  • Чтобы вывести список всех локальных групп на локальном сервере, введите: net localgroup;
  • Чтобы добавить локальную группу «Group1» в локальную базу учетных записей пользователей, введите: net localgroup Group1 /add;
  • Чтобы добавить локальную группу «Group1» в базу учетных записей пользователей домена, введите: net localgroup Group1 /add /domain;
  • Чтобы добавить учетные записи существующих пользователей «User1», «User2» и «User3» в группу «Group1» домена, введите: net localgroup Group1 User1 User2 Use3 /add /domain;
  • Чтобы вывести список пользователей локальной группы «Group1», введите: net localgroup Group1;
  • Чтобы добавить комментарий к локальной группе «Group1», введите: net localgroup Group1 /comment:»Руководящий персонал».

Видео — Работа с утилитой NET LOCALGROUP

Add user to group from command line (CMD)

Windows provides command line utilities to manager user groups. In this post, learn how to use the command net localgroup to add user to a group from command prompt’

Add user to a group

Run the steps below –

  1. Open elevated command prompt
  2. Run the below command

For example to add a user ‘John’ to administrators group, we can run the below command.

Few more examples:

To add a domain user to local users group:

This command should be run when the computer is connected to the network. Otherwise you will get the below error.

To add a domain user to local administrator group:

To add a user to remote desktop users group:

To add a user to debugger users group:

To add a user to Power users group:

This command works on all editions of Windows OS i.e Windows 2000, Windows XP, Windows Server 2003, Windows Vista and Windows 7. In Vista and Windows 7, even if you run the above command from administrator login you may still get access denied error like below.

The solution for this is to run the command from elevated administrator account. See How to open elevated administrator command prompt

When you run the ‘net localgroup’ command from elevated command prompt:

To list the users belonging to a particular group we can run the below command.

For example to list all the users belonging to administrators group we need to run the below command.

CMD. Управление пользователями в Windows.

Управление пользователями в Windows, помимо графической оснастки «Учетные данные пользователей», расположенной в панели управления, можно производить с помощью командной строки.

Команда NET USER

Команда NET USER предназначена для просмотра, добавления или редактирования учетных записей пользователей на компьютерах. При выполнении команды в командной строке без параметров отображается список учетных записей пользователей Windows, присутствующих на компьютере(локальные УЗ). Информация об учетных записях пользователей хранится в базе данных Windows.

Синтаксис команды NET USER

net user [имя_пользователя [пароль | *] [параметры]] [/domain]

net user имя_пользователя <пароль | *>/add [параметры] [/domain]

net user имя_пользователя [/delete] [/domain], где

  • имя_пользователя — Указывает имя учётной записи пользователя, которую можно добавить, удалить, отредактировать или просмотреть. Имя может иметь длину до 20 символов.
  • пароль — Присваивает или изменяет пароль пользователя. Введите звездочку (*) для вывода приглашения на ввод пароля. При вводе с клавиатуры символы пароля не выводятся на экран.
  • /domain — Выполняет операцию на контроллере основного для данного компьютера домена.
  • параметры — Задает параметр командной строки для команды.
  • net help команда — Отображение справки для указанной команды net.
  • /delete — Удаление учетной записи пользователя.

How do I view all the users on a Windows computer? (5 ways)

Sometimes, you may need to extract a list of all the user accounts on a Windows computer. Or you may want to know the hidden user accounts that exist alongside your user account. To help you out, we compiled a list of five methods that you can use to see all the users, including the hidden ones created by Windows or third-party apps that you installed. Here they are:

Quick Steps:

  1. Open CMD or PowerShell.
  2. Type net user, and press Enter.
  3. Net user lists the users that have accounts configured on a Windows PC, including hidden ones or disabled user accounts.

NOTE: This guide covers Windows 10, Windows 7, and Windows 8.1. If you don’t know the Windows version that you have, read How to tell what Windows I have (11 ways).

1. How to see users using the Windows command line (PowerShell & CMD list users)

This method works both in the Command Prompt and PowerShell. Open the command-line app that you prefer, type net user, and press Enter. Net user lists the users that have accounts configured on a Windows PC, including hidden ones or disabled user accounts. The user accounts are listed by their internal names that Windows uses behind the scenes, not by their full display name that you see when you sign in to Windows.

Run net user to make Windows CMD show users

You can also have the net user list stored in a text file that opens in Notepad or any other text editor. Type net user > filename.txt, and a file with the name you provided is created under “C:\Users\Your User Name.”

Save the net list of users to a file using net user > filename.txt

If you want to export the CMD list of users to a text file that’s saved in a location you choose, enter net user > “path\filename.txt” and press Enter.

Export the CMD list of users to a file at a specified location

A neat trick is using this command to find information about a specific user account: type net user username and press Enter. Windows then displays helpful information about that user account, like when the password was set the last time, when it expires (if it’s set to expire), the groups it’s a part of, and more.

Getting details about a user account in CMD, using the net user command

If you want to know more about this command and all its parameters, go to this documentation page: Net user.

2. How to use PowerShell to get all users on a computer

Besides the net user command, here’s another command that you can use in PowerShell to view all users in Windows 10 or previous versions: Get-WmiObject Win32_UserAccount -filter “LocalAccount=True” | Select-Object Name,FullName,Disabled.

Get-WmiObject Win32_UserAccount -filter “LocalAccount=True” | Select-Object Name,FullName,Disabled

Alternatively, if you use Windows 10, you can also run the simpler get-localuser command, as pointed out by one of our readers.

Using PowerShell to get all users on a computer

3. How to see the list of all user accounts in Computer Management

Another method that displays all user accounts, including hidden users or disabled ones, involves using Computer Management. Open Computer Management, and go to “Local Users and Groups -> Users.” On the right side, you get to see all the user accounts, their names as used by Windows behind the scenes, their full names (or the display names), and, in some cases, also a description.

Windows list of users displayed in Computer Management

Double-click or double-tap on a user account to learn more about its properties and settings, including the user groups that it is part of.

4. How to see the list of active user accounts using the Control Panel

A method that is less geeky but which also displays less information involves opening the Control Panel. After you start it, go to “User accounts” or “User Accounts and Family Safety,” depending on the Windows version that you have.

The User Accounts entry from the Control Panel

Then, click or tap on User accounts.

Opening the User Accounts settings

Now you see your user account, information about it, and several links. Click or tap the link that says “Manage another account.”

Manage another account

Now you see the active, not-hidden user accounts in Windows, whether they are local accounts, administrators, etc.

Control Panel shows the list of users on a Windows computer

With this method, you cannot see hidden or disabled user accounts.

5. How to see the list of active user accounts on the Windows sign-in screen

The obvious and most straightforward method is to look at the sign-in screen just before you log into Windows. You should see all the active (not hidden) user accounts that exist in Windows on this screen. If you are using Windows 10, this list is shown in the bottom-left corner of the sign-in screen.

Windows 10 list of users shown on the sign-in screen

If you are using Windows 7, all active user accounts are displayed front and center.

Windows 7 list of users shown on the sign-in screen

The same is true when using the Windows 8.1 sign-in screen.

Windows 8.1 list of users shown on the sign-in screen

The downside of this method is that you cannot see hidden or disabled user accounts.

Did you find many hidden user accounts on your Windows PC?

We highly recommend trying the first three methods for identifying all the user accounts that exist on your Windows computer or device. You may be surprised to see that some of your apps created hidden user accounts that you had no idea existed. Before closing this tutorial, share in a comment whether you found hidden user accounts on your PC and how many of them were there. We are curious to know.

Windows admin blog

Полезные команды cmd, powershell, администрирование, фичи и решения проблем на win/winserver

AD: узнать в каких группах состоит пользователь / прямое и косвенное членство

В этой статье речь пойдет о том, как вывести список групп, в которых состоит пользователь. Конечно, это можно сделать из GUI, но не всегда такой вывод удовлетворяет цели.

Также, через GUI вы не определите ПОЛНЫЙ список членства (т.н. косвенное членство), когда одни группы могут быть вложены в другие.

Если группа, в которой состоит пользователь, является вложенной группой другой группы — пользователь наделяется полномочиями, заданными конечной группе, хотя и не является ее членом напрямую. Эту группу вы не увидите на вкладке пользователя «Член групп» (Member of)

Рассмотрим в рамках этой статьи следующие инструменты:

  • whoami /groups — членство в группах текущего пользователя
  • dsget user — покажет прямое и косвенное членство
  • Get-ADUser (Powershell)

1) Whoami /groups

Если нам необходимо узнать, в каких группах состоит текущий пользователь , под которым мы залогинены, можно воспользоваться командой:

Правда вывод не очень удобен для восприятия. Будут отображены все группы с прямым и косвенным членством

2) Утилита dsget

Вывести список групп, в которых состоит пользователь:

(в данном примере выводим список групп, в которых состоит пользователь Peter Parker, находящийся в OU «IT department\Support team»)

Следующая команда отобразит расширенный список групп, в т.ч. в которых косвенно состоит пользователь (ключ -expand)

Утилита dsget доступна только на контроллерах домена

3) Get-ADUser

Для выполнения командлета Get-ADUser требуется установить Powershell модуль Active-Directory.

Чтобы вывести список групп требуемого пользователя в удобном формате, необходимо выполнить следующий конвейер команд в powershell:

Примечание: данная команда выведет прямое членство (по сути, содержимое закладки пользователя «Член групп» (Member of)

Читайте также:  Почему windows не unix подобная система
Оцените статью