Get-PnPMicrosoft365GroupOwners returning only PnP.PowerShell.Commands.Model.Microsoft365User #833
-
I will attach my code below. When using Get-PnPMicrosoft365GroupOwners, the cmdlet is only returning PnP.PowerShell.Commands.Model.Microsoft365User, rather than name of the owner. It gives the correct amount of users, but no real information. I am able to view Owners of sites that only have a single owner. Any help would be appreciated, $SiteCollections = Get-PnPTenantSite -Filter "Url -like $TenantSiteBaseURL -and Url -notlike '-my.sharepoint.com/' -and Url -notlike '/portals/'" | ForEach-Object { Get-PnPTenantSite -Url $_.Url | select Title,Url,GroupId,Owner } ForEach ($Site in $SiteCollections){ |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I realized I am getting an object rather than a string, and I needed to get the email property from the object. Here is my fix $Group = Get-PnPMicrosoft365Group -Identity $Site.GroupId -IncludeOwners |
Beta Was this translation helpful? Give feedback.
I realized I am getting an object rather than a string, and I needed to get the email property from the object. Here is my fix
$Group = Get-PnPMicrosoft365Group -Identity $Site.GroupId -IncludeOwners
$Emails = ($Group.Owners | Select Email)