Kelly Garcia
asked on
Check if users are in group - powershell
Hi guys,
I have a list of users and a list of groups and I need to check if those users are in the group, so far I have written this script, please can someone help me complete it:
$m=Get-QADGroup "*pae*admin*" | Get-QADGroupMember
$p=Get-QADGroup "*pae*"
I need to check if the users in $m exist in the groups in $p
thank you in advance.
I have a list of users and a list of groups and I need to check if those users are in the group, so far I have written this script, please can someone help me complete it:
$m=Get-QADGroup "*pae*admin*" | Get-QADGroupMember
$p=Get-QADGroup "*pae*"
I need to check if the users in $m exist in the groups in $p
thank you in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
HI,
Is there anyone that can help me with this? I know its something simple, but I just can figure it out.
Regards,
kay
Is there anyone that can help me with this? I know its something simple, but I just can figure it out.
Regards,
kay
You'll have to clarify your intentions because the example you proposed in the beginning suffers from the group name confusion.
The most efficient way to check if a user exists in two groups is to write an LDAP query that only returns those results. However, it can't be a wild-card based search.
If you must use wild-cards you can't overlap them (as David has pointed out), it doesn't make sense to do so.
Is the example in the first instance accurate?
Chris
The most efficient way to check if a user exists in two groups is to write an LDAP query that only returns those results. However, it can't be a wild-card based search.
If you must use wild-cards you can't overlap them (as David has pointed out), it doesn't make sense to do so.
Is the example in the first instance accurate?
Chris
2. "*pae*"
will always return true as all members of 1 are members of 2 pae*admin* is a member of pae*