Have you tried to output the group name you get from your AD? The culprit might be there - not in the string you place manually in your $CommonGroups variable.
It could be an ambiguous character …
'GPAP-M365-E3―Base'
'GPAP-M365-E3-Base'
These two strings are not equal!! ![]()
