Programming:Windows PowerShell

From Wiki
Revision as of 17:29, 2 February 2016 by Deoren (talk | contribs) (Added example of dumping list of groups that a user account is a member of (lifted directly from stack overflow))
Jump to: navigation, search

Look up Active Directory group members

I found this tip on

Import-Module ActiveDirectory
Get-ADGroupMember "MyADGroupName" | Select-Object name | Sort-Object name

Unfortunately that doesn't expand all group members, whereas this command-line tool does:

dsquery group -name "MyADGroupName" | dsget group -members -expand

Look up group memberships for user account

Import-Module ActiveDirectory
Get-ADPrincipalGroupMembership username | select name
Domain Users
Domain Computers
Workstation Admins
Company Users
Company Developers