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

前端 未结 7 588
南旧
南旧 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:14

    A little stale post, but I figured what the heck. Does "whoami" meet your needs?

    I just found out about it today (from the same Google search that brought me here, in fact). Windows has had a whoami tool since XP (part of an add on toolkit) and has been built-in since Vista.

    whoami /groups
    

    Lists all the AD groups for the currently logged-on user. I believe it does require you to be logged on AS that user, though, so this won't help if your use case requires the ability to run the command to look at another user.

    Group names only:

    whoami /groups /fo list |findstr /c:"Group Name:"
    

提交回复
热议问题