Select array within an array

Get-MgGraph cmdlet has AdditionalProperties array. Then AdditionalProperties has further resourceProvisioningOptions.

So Get-MgGraph spits out all the groups. I would like to select only groups which has resourceProvisioingOptions equal to Team.

Below command gives the AdditionalProperties value only, and I don’t see the display names since it is expanding the property.
Get-MgGroup | Select-Object -ExpandProperty AdditionalProperties

Below command shows the value of resourceProvisioingOptions
(Get-MgGroup | Select-Object -ExpandProperty AdditionalProperties).resourceProvisioingOptions

Seeking some assistance on how to get DisplayNames for groups which has resourceProvisioingOptions equal to Team.

If it’s an array of strings you just use -contains or -icontains string operator

1 Like

Hi Jaysingh. Please format your code properly, it helps a bunch. You should be able to do this

Get-MgGroup | Where-Object {$_.additionalproperties.resourceProvisioningOptions -contains 'Team'}
2 Likes