Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Matching group membership from user list

$
0
0

Hi all,

I have a list of sAMaccountNames and am trying to figure out if from that list any of the user objects are members of a set of security groups.

There are two apps that have sets of groups assigning permissions. I want to find out if anyone in this list is provisioned for either app at any level. Here is what I have so far:

$users = Get-Content c:\Users\hcsjcl\Desktop\list.csv
ForEach($user in $users){
	$object = Get-QADUser $user
	$groups = Get-QADMemberOf $object
	if($groups -match 'App1'){

	}
	if($groups -match 'App2'){
	
	}
}

I have tried capturing the result of the regex but havent had any luck. If I try and output $matches I get null array errors. Am I approaching this right?


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>