| title | xp_enumgroups (Transact-SQL) | ||
|---|---|---|---|
| description | Provides a list of local Microsoft Windows groups or a list of global groups that are defined in a specified Windows domain. | ||
| author | markingmyname | ||
| ms.author | maghan | ||
| ms.reviewer | randolphwest | ||
| ms.date | 06/23/2025 | ||
| ms.service | sql | ||
| ms.subservice | system-objects | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
[!INCLUDE SQL Server]
Provides a list of local Microsoft Windows groups or a list of global groups that are defined in a specified Windows domain.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
xp_enumgroups [ 'domain_name' ]
[!INCLUDE extended-stored-procedures]
The name of the Windows domain for which to enumerate a list of global groups. domain_name is sysname, with a default of NULL.
0 (success) or 1 (failure).
| Column name | Data type | Description |
|---|---|---|
| group | sysname | Name of the Windows group |
| comment | sysname | Description of the Windows group provided by Windows |
If domain_name is the name of the Windows-based computer that an instance of [!INCLUDE ssNoVersion] is running on, or no domain name is specified, xp_enumgroups enumerates the local groups from the computer that is running [!INCLUDE ssNoVersion].
Requires membership in the db_owner fixed database role in the master database, or membership in the sysadmin fixed server role.
The following example lists the groups in the sales domain.
EXECUTE xp_enumgroups 'sales';