Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get-RubrikM365SizingInfo.ps1 fails if you have multiple groups with same displayname. #19

Open
Trerot opened this issue Jan 9, 2024 · 0 comments

Comments

@Trerot
Copy link

Trerot commented Jan 9, 2024

Get-RubrikM365SizingInfo.ps1, line 311.

$AzureAdGroupDetails = Get-MgGroup -Filter "DisplayName eq '$AzureAdGroupName'"

Filter uses DisplayName. Which is not a uniqe property. script fails if you have multiple groups with same displayname, typically security and distribution groups with same displayname.

Changing to GUID or adding something that handles multple groups solves it.

To make it work in my case where it has multiple groups with the same displayname, I just picked the first one. Should work regardless of result size.

$AzureAdGroupDetails = Get-MgGroup -Filter "DisplayName eq '$AzureAdGroupName'" | Select-Object -First 1

alternatively

if ($AzureAdGroupDetails.Count -gt 1) { 
# Some message here about multiple groups. and selecting the first 1
 $AzureAdGroupDetails = $AzureAdGroupDetails | Select-Object -First 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant