Forum Discussion
Owner Count
Hi stefan
Sorry I can’t understand your question , I have already given a query to list entire office 365 groups with entire owners (Mangedby or Mangedbydetails )count
Or
If you want name of all owners of a group you try with vasil query
Or
If you want Find office 365 groups list by specific owner in tenant try following query
$Ownername = "AlexW" $groups = Get-UnifiedGroup -ResultSize Unlimited |select displayname,ManagedByDetails $i=0 $groupname = '' Foreach($group in $groups) { $Gname= $group |Where-Object {$group.ManagedByDetails -eq "$Ownername"} |select displayname If($Gname -ne $null) { $j =1 $i = $j +$i If($groupname) { $groupname= $groupname+","+$Gname.displayname.ToString() } else { $groupname= $Gname.displayname.ToString() } } } Write-host "$($Ownername) was owner of $($i) Groups" Write-host "$($Ownername) was owner of following Groups : $($groupname)"
Or
If you want total number of owner in tenant try following query
$mboxs= get-mailbox -ResultSize Unlimited -RecipientTypeDetails UserMailbox $L =0 Foreach($mbox in $mboxs) { $groups = Get-UnifiedGroup -ResultSize Unlimited |select displayname,ManagedByDetails,@{N="Ownercount"; E={($_.ManagedByDetails.count)}} $i=0 $groupname = '' Foreach($group in $groups) { $Gname= $group |Where-Object {$group.ManagedByDetails -eq $mbox.Identity} |select displayname If($Gname -ne $null) { $j =1 $i = $j +$i If($groupname) { $groupname= $groupname+","+$Gname.displayname.ToString() } else { $groupname= $Gname.displayname.ToString() } } } if($i -ne 0) { $K=1 $L = $L+$k Write-host "$($mbox.Identity) was owner of $($i) Groups" Write-host "$($mbox.Identity) was owner of following Groups :" -NoNewline Write-host "$($groupname)" -ForegroundColor Red Write-host "----------------------------------------------------------------" -ForegroundColor Green } } Write-Host "Total number of office 365 group owners in the tenant is $($L)" -ForegroundColor Yellow
I need to know rather say i need a report on Office 365 groups which shows the list of users who are owners of the group(s) , group names and group count
So the table should look like
user/owner name(UP/Email), Group Names, Group Count
Strange thing is your script does the similar but not in the tabular format however only shows two users whereas there are many owners in the Azure AD
BR,
/HS