Skip to content

Script to Export Office 365 Group Information to CSV

Office 365 Groups Comprehensive Export Script

Section titled “Office 365 Groups Comprehensive Export Script”

This PowerShell script provides comprehensive extraction of Office 365 Groups information across your Microsoft 365 tenant. By capturing detailed group metadata including ownership, membership, privacy settings, SharePoint integration, and creation timestamps, this script enables thorough group auditing, governance analysis, and organizational collaboration review.


FeatureCapabilityBusiness Value
Complete Group InventoryRetrieves all Office 365 groups organization-wideProvides comprehensive group landscape view
Ownership TrackingCaptures group owners and their contact informationEnables accountability and access management
Membership AnalysisLists all group members with email addressesSupports license planning and access review
Privacy ClassificationDocuments group privacy settings (Public/Private)Assists with compliance and governance
SharePoint IntegrationCaptures associated SharePoint site URLsProvides collaboration platform mapping
Metadata TimestampsRecords creation and modification datesEnables lifecycle management tracking

  • Exchange Online PowerShell module installed
  • Exchange Administrator or appropriate permissions
  • Sufficient disk space for export files
  • Network connectivity to Exchange Online
Terminal window
$csvFilePath = "Office365GroupsInfo.csv" # Output file path

Terminal window
# Specify CSV file path for export
$csvFilePath = "Office365GroupsInfo.csv"
# Get all Office 365 groups in the tenant
$groups = Get-UnifiedGroup -ResultSize Unlimited
# Prepare CSV data
$csvData = foreach ($group in $groups) {
    [PSCustomObject]@{
        'Group Name' = $group.DisplayName
        'Group Alias' = $group.Alias
        'Group Type' = $group.GroupType
        'Owners' = (Get-UnifiedGroupLinks -Identity $group.DistinguishedName -LinkType Owners | Select-Object -ExpandProperty PrimarySmtpAddress | ForEach-Object {$_}) -join ','
        'Members' = (Get-UnifiedGroupLinks -Identity $group.DistinguishedName -LinkType Members | Select-Object -ExpandProperty PrimarySmtpAddress | ForEach-Object {$_}) -join ','
        'Privacy' = $group.AccessType
        'Managed By' = $group.ManagedBy
        'Description' = $group.Description
        'Creation Time' = $group.WhenCreated
        'Last Modified Time' = $group.WhenChanged
        'Site URL' = $group.SharePointSiteUrl
    }
}
# Export to CSV
$csvData | Export-Csv -Path $csvFilePath -NoTypeInformation -Force