Forum Discussion
Daniel Westerdale
Feb 13, 2020Iron Contributor
Getting the group owner for each Office 365 Group
Using a minimilst approach to PowerShell , I am looking to show the group name and the name(s) of each owner
Connect-PnPOnline -Scopes "Group.ReadWrite.All","User.Read.All","Directory.Read.All","Sites.Read.All"
# create an interim collection whilst I test
$unifiedGroups = Get-PnPUnifiedGroups
$unifiedGroups[3] | foreach { $GroupName = $_.DisplayName; $groupId = $_.GroupId; $groupOwner = Get-PnpUnifiedGroupOwners -Identity $groupId ; Write-Host "$groupName | $groupOwner" }
It almost works but it's the group owner that is stressing me
MyTestOfficeGroup | OfficeDevPnP.Core.Entities.UnifiedGroupUser
I just need resolve this collection for each group and or rewrite the snippet above using Select-Object, to replace the Write-host.
One thing I have noticed is issues displaying the Site Urls.
DisplayName Group Id Site URL
----------- -------- --------
MyTestOfficeGroup ??????-610f-4639-8a3e-09e6717143ed The caller does not have permission...
No RepliesBe the first to reply