This Powershell onliner is used to list members object in a group.

You can easly retrieve and produce a list of group with users and membergroup in a group.

How to use :

Simply copy/paste code in powershell

You can cible a particular group with {name -like "Name_of_Group"} or list entire group with {name -like "*"}

 

List Users and MemberGroup for filtered groups and create csv file

get-adgroup -Filter {name -like "Name_of_Group"}|%{$u=$_.name;get-adgroupmember $_.name}|%{if ($_.objectclass -eq "group") {$_|select @{E={$u};N="Group"},@{E={$_.name};N="GroupMember"}} ElseIf ($_.objectclass -eq "user") {get-aduser $_ -properties *|select @{E={$u};N="Group"},@{E={};N="GroupMember"},name,givenname,surname,enabled}}|convertto-csv|out-file c:\temp\group.csv

 

 

PowerShell
Modifier le script|Remove
get-adgroup -Filter {name -like "Name_of_Group"}|%{$u=$_.name;get-adgroupmember $_.name}|%{if ($_.objectclass -eq "group") {$_|select @{E={$u};N="Group"},@{E={$_.name};N="GroupMember"}} ElseIf ($_.objectclass -eq "user") {get-aduser $_ -properties *|select @{E={$u};N="Group"},@{E={};N="GroupMember"},name,givenname,surname,enabled}}|convertto-csv|out-file c:\temp\group.csv