Hi, Im having issues with a script I have written. It dont work and returns nothing. Basically I have a list of users that i am checking to see if they have 2 ad groups. if they have then its recorded in a csv.
Here is my code, any help would be appreciated.
$textFileContents = Get-Content C:\temp\powershell\users.txt
$results = @()
foreach($username in $textFileContents){
$groups = get-qaduser $username |select -expand memberof
if ($groups -match "group2" -and $groups -match "group1"){
echo $groups | select Identity,Name,LastName | export-csv c:\temp\powershell\users.csv
}
}