How to ADD multiple users in AD group using Powershell

Nilo
Tera Contributor

Using List Collector i am selecting multiple and want to check which user is present in AD group and which user is not preset. Users which are not present in AD Group i want to Add them automatically using orchestration can anyone help ,how to do this ?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Nilo,

you can use this in powershell

Add-ADGroupMember testgroup testuser1,testuser2

the samaccountnames are comma separated

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Nilo,

you can use this in powershell

Add-ADGroupMember testgroup testuser1,testuser2

the samaccountnames are comma separated

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Thanks Ankur

Can i send array directly ? 

Hi,

Just ensure you have those as comma separated

better to use toString() on array so that it is comma separated

Regards

Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader