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...
- Determine the ID of the second AD group
- Set the primary group ID of the user to that of #1
- 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.
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.