Compare group Objects and list missing users

Using  compare object and qad cmdlets because the environment I am in still has AD 2003. I want to compare security groups I am migrating over and make sure the user accounts are all there. if not list the missing user account from the source domain that's missing in the target domains groups.

This is what I have but its not giving me the result I want:

get-qadgroupmember 'cn=accounting users, OU=Department Groups, DC=domain, DC=com' -type user) + (get-qadgroupmember 'cn=account users,  OU=Department Groups, DC=NewDomain, DC=com' type user) | select -expand property samaccountname | sort | select -unique

Open in new window


However it doesn't give me what I want.

Any ideas?

Open in new window

Who is Participating?
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.

Try this and let me know if you get desired result..
$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

Open in new window

ntr2defAuthor Commented:
Does this mean that this user is missing from GroupB?

InputObject                                                                         SideIndicator
-----------------                                                                         -------------------
TestUser100                                                                        =>
TestUser10                                                                          =>
TestUser1                                                                            =>
compare $GroupA $GroupB

SideIndicator => means the object is missing from GroupA
SideIndicator <= means the object is missing from GroupB

For more details about compare refer:

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
ntr2defAuthor Commented:
what if i wanted to do a bulk list of groups say like 30
I can be done by using a input file with the information to compare the group names and using same commands to loop through information.. You may open a new question to get solution as this one is already closed..
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.