Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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