Get user's non-truncated Active Directory groups from command line

前端 未结 7 583
南旧
南旧 2021-01-30 00:46

I often use the net user command to have a look at AD groups for a user:

net user /DOMAIN 

This works well, howeve

7条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-30 01:25

    Much easier way in PowerShell:

    Get-ADPrincipalGroupMembership

    Requirement: the account you yourself are running under must be a member of the same domain as the target user, unless you specify -Credential and -Server (untested).

    In addition, you must have the Active Directory Powershell module installed, which as @dave-lucre says in a comment to another answer, is not always an option.

    For group names only, try one of these:

    (Get-ADPrincipalGroupMembership ).Name
    Get-ADPrincipalGroupMembership  |Select Name
    

提交回复
热议问题