@Good, Anthony , use or edit the following PowerShell script to export group owners. You will need MSAL.PS and Microsoft Graph PowerShell SDK installed. There's no "last used" property. For a list of available properties take a look to the documention for user and group resources.
Connect-MgGraph -AccessToken `
( (Get-MsalToken -ClientId 14d82eec-204b-4c2f-b7e8-296a70dab67e -TenantId "string(optional)" `
-Scopes "Directory.Read.All", "AuditLog.Read.All" -ForceRefresh).AccessToken |
ConvertTo-SecureString -AsPlainText -Force)
Get-MgGroup -Property "id,displayName,createdDateTime" -ExpandProperty 'owners($select=id,displayName,createdDateTime)' |
ForEach-Object { $group = $_; $_.Owners |
Select-Object @{N = "GroupId"; E = { $group.id } } , @{N = "GroupDisplayName"; E = { $group.displayName } }, `
@{N = "GroupCreatedDateTime"; E = { $group.createdDateTime } } , @{N = "OwnerId"; E = { $_.Id } } , `
@{ N = "OwnerDisplayName"; E = { $_.AdditionalProperties.displayName } } , `
@{N = "OwnerCreatedDateTime"; E = { $_.AdditionalProperties.createdDateTime } } } |
ConvertTo-Csv -NoTypeInformation |
Out-File GroupOwners.csv -Encoding utf8
Let us know if you need additional assistance. If the answer was helpful, please accept it and rate it so that others facing a similar issue can easily find a solution.