I am creating AD accounts via a powershell script. It also adds a user to a second AD group. By default, this user is placed in the Domain Users group, which is the primary group. How can I...

  1. Determine the ID of the second AD group
  2. Set the primary group ID of the user to that of #1
  3. Delete the user from the Domain Users group (this should be easy once #1 and #2 are done).

My script is using [ADSI] commands to create the user & add them to the second group. I am not using any add ons such as MS-AD or Quest.

link|improve this question

65% accept rate
feedback

1 Answer

up vote 3 down vote accepted

Looks like I asked too soon. This is what I was looking for.

Changing Primary Group with Powershell

Searching for "powershell primaryGroupToken" on Google is what did the trick.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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