Aug 08 2019 08:10 AM
Hi All,
I have tested below script for pulling SharePoint groups ( including their members ) and the permissions for a SharePoint Online site collection :
Import-Module Microsoft.Online.Sharepoint.PowerShell -DisableNameChecking
$AdminSiteURL="URL"
#Connect To SharePoint Online
Connect-SPOService -url $AdminSiteURL
#Get the Site collection
$URL = Get-SPOSite -Identity "URL"
#Get all Groups of the site collection
$GroupColl = Get-SPOSiteGroup -Site $URL
Foreach($Group in $GroupColl)
{
#Get Permissions assigned to the Group
$GroupPermissions=""
ForEach($Role in $Group.Roles)
{
$GroupPermissions+= $Role+";"
}
Write-host -f Yellow "Group Name: $($Group.Title) - Permissions: $($GroupPermissions)"
#Get each member of the group
foreach($User in $Group.Users)
{
write-host -f Green $user
}
}
But, we have a requirement to get direct and domain group permissions as well. I am not getting any leads to how modify the above script .
Has anyone worked on such script before or have any idea how to modify the above one ?
Regards,
Vimmi