Thursday, 22 August 2013

List All Groups and Their Members with PowerShell on Win2008r2

List All Groups and Their Members with PowerShell on Win2008r2

I am new to powershell, but I've been reading manuals and practiced a
little bit. My objective is to List all users in all Security Groups under
specified path. I have found the way to do it:
get-adgroup -Filter * -SearchBase
"OU=Groups,DC=corp,DC=ourcompany,DC=Com" | %{Get-ADGroupMember $_.name}
| ft name
But the problem is I do not see the group name. All I get is a bunch of
users. It would be nice if someone could tell me how to display the group
name before all the members of this group get listed. Thanks.

No comments:

Post a Comment