Reputation: 322
I have a list of users , I want to check if the input list of users are member of a particular group, Sorry to ask such basic question , as I am beginner in powershell.
I have only user_id in the list , I want to compare each user id with one group , whether user is a member of that one group or not. Like say user,user2,user3 is a member of testgroup.
For example -
user1 testgroup user2 testgroup user3 testgroup
Regards Naveen
Upvotes: 1
Views: 1046
Reputation: 16616
If your Csv looks like this:
username, groupname
a12358, european administrators
m235813, european users
this one-liner will return the users that are member of the corresponding group:
import-csv usergroup.csv | foreach-object {get-qaduser $_.username -memberof $_.groupname}
Upvotes: 1