Attempting to run 1 ps script by having the groups in a text file..
$groups = Get-Content c:\groups.txt {
foreach($Group in $Groups)
Get-ADGroupMember -identity "$groups" | select samaccountname,name "c:\test.txt" }
Missing statement body in foreach loop. At line:3 char:1 + <<<< Get-ADGroupMember -identity "$groups" | select samaccountname,name >> "c:\test.txt" } + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : MissingForeachStatement