- Download and install the SharePoint Online Client Components SDK.
- Open the PowerShell ISE.
- Run the following script, typing the appropriate values for $Url and $Path variables to specify the SharePoint site address and the report output path:
#SPO-specific cmdlets require sharepoint-online module
Install-Module -NameMicrosoft.Online.SharePoint.PowerShell
$ServiceURL ="https://enterprise-admin.sharepoint.com"
$URL = "https://enterprise.sharepoint.com"
$Path = "C:\Temp\GroupsReport.csv"
$Cred = Get-Credential
#Connect to SharePoint Online
Connect-SPOService -url$ServiceURL -Credential$Cred
#Generating Report
$GroupsData = @()
#get sharepoint online groups powershell
$SiteGroups =Get-SPOSiteGroup -Site$URL
ForEach($Group in $SiteGroups) {
$GroupsData +=New-Object PSObject-Property @{
'Group Name' =$Group.Title
'Permissions' =$Group.Roles -join ","
'Users' = $Group.Users -join ","
}
}
#Export the data to CSV
$GroupsData |Export-Csv $Path-NoTypeInformation
4. Review your CSV report:
- Run Netwrix Auditor. Navigate to “Reports” -> Click “Predefined” -> Expand the “SharePoint Online” section -> Go to “SharePoint Online – State-in-Time” -> Select “SharePoint Online Object Permissions” -> Click “View”.
- Specify the site URL in the “Object Path” field -> Click “View Report”.
- Review the easy-to-understand report: