Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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.