azure-activedirectory-powershell icon indicating copy to clipboard operation
azure-activedirectory-powershell copied to clipboard

Does not display the first variable

Open Pousla opened this issue 4 years ago • 0 comments

Hello, The following script does not display the first variable of $GroupMember. I think the problem in on the module because I tried the script with different parameters (for example without the | where), the issue is still here. The list could be sort by different way, but the first $GroupMember still not displayed.

$GroupMember=""
$Groups = Get-AzureADGroup
foreach ($Group in $Groups) {
    $GroupMember = Get-AzureADGroupMember -ObjectId $Group.ObjectId | where {$_.UserType -eq 'Guest'}
    if ($GroupMember) {
        Write-Host `n "Group :" -ForegroundColor Green $Group.DisplayName "-" $Group.ObjectId
        $GroupMember | select DisplayName,UserPrincipalName,UserType
    }
}

I found a different way to display what I want, but it could be good to fix this issue :) Tanks for help

Pousla avatar Feb 18 '21 18:02 Pousla