Powershell Exchange Group check - How could i change to all groups begins with E*

hi,

how could i change the code below that all groups begins with "E" will be check.
I tried with "E*" but not working.

 $GROUP = (Get-ADUser -identity $user.userid -Properties *).MemberOf | % { ($_ -split ",")[0] } | Where { $_ -eq "CN=E*" }

Open in new window


thanks
LVL 2
Mandy_Asked:
Who is Participating?
 
Meir RivkinConnect With a Mentor Full stack Software EngineerCommented:
change it to:
| Where { $_ -like "CN=E*" }

Open in new window

0
 
SubsunCommented:
Try with -like..
 $GROUP = (Get-ADUser -identity $user.userid -Properties *).MemberOf | % { ($_ -split ",")[0] } | Where { $_ -like "CN=E*" }

Open in new window

0
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
Get-DistributionGroupMember | Where {$_.Name -Like "E*"}

- Rancy
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.