I had a script who get all users of sharepoint site. So I can get group for each member but can you get all group of sharepoint site and get all users of each group?
Thanks
Use the following PowerShell script for getting all users for each SP group for given SPWeb
$web = Get-SPWeb "http://YourWebURL/"
foreach ($group in $web.groups){
write-host -foregroundcolor white "----Collecting users from group:"$group.Name "..."
foreach($user in $group.users) {
if ($user.Loginname.StartsWith("SHAREPOINT\")) {continue}
if ($user.Loginname.StartsWith("NT")) {continue}
write-host -foregroundcolor Yellow "-------User:"$user.DisplayName
}
}
$web.Dispose()