List group memberships for AD users

Question:

Using the following Powershell snippet I get the names of the group memberships for the current user:

How can I modify this such I can supply the user account name as parameter?

Thanks,

Uwe

Answer:

If you have access to the ActiveDirectory module, I’d suggest you use Get-ADUser. In case you can’t use that module, you could use the System.DirectoryServices.AccountManagement assembly:

Source:

List group memberships for AD users by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply