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.

thank you...


Use the -c parameter. As in:

dsquery user -samid B | dsget user -memberof -expand |dsmod group -c -addmbr "A"

  • is it possible you can tell me a good website or book which i can use to learn VBScript to get the reports from AD or do user administation in AD or export AD results into excel, etc. any help would be nice!!! – newbie Jul 27 '11 at 15:09
  • quite frankly the ds* command are quite good at doing the above listed requirements. – tony roth Jul 27 '11 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.