i am trying to assign user A with the same group memberships as user B. the problem is user A is already member of some of the groups user B is and when i try to run below command it errors out as soon as it finds the group user A is already member of. e.g. user A is member of abc, def and user B is member of abc, ghi, lmn and when i run this command, it stops processing and gives me an error saying user A is already member of group abc and doesnt go any further.
so could you please tell me how can make the assignment keep going and skip whatever group user A is assigned to?
dsquery user -samid B | dsget user -memberof -expand |dsmod group -addmbr "A"
please provide non-programming solution as not good at programming.