azure-activedirectory-powershell
azure-activedirectory-powershell copied to clipboard
Does not display the first variable
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