compare groups using an input file

Using what was provided to me. How do I expand on this by using an input file to provide me what I need in bulk.

$GroupA = get-qadgroupmember 'cn=accounting users, OU=Department Groups, DC=domain, DC=com' -type user | select -expand property samaccountname
$GroupB = get-qadgroupmember 'cn=account users,  OU=Department Groups, DC=NewDomain, DC=com' type user | select -expand property samaccountname

compare $GroupA $GroupB
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
accountingusers,department Groups,domain,account users,department groups,newdomain

Open in new window

$users = import-csv .\test.csv
foreach ($user in users)
$GroupA = get-qadgroupmember '"cn="$user.oldcn",OU="$user.oldou",DC="$user.oldc1",DC="$user.olddc2' type user | 
		select -expand property samaccountname
$GroupB = get-qadgroupmember '"cn="$user.newcn",OU="$user.newou",DC="$user.newdc1",DC="$user.newdc2' type user | 
		select -expand property samaccountname
#assume youh have a compare function somewhere
compare $GroupA $GroupB

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.