Adding a User to a Domain Group

Groups are not really all that interesting. About the only details that get modified in groups are the members. In this section, you'll learn about the steps involved in assigning domain users to domain groups.

The process of adding a user to a group is a little strange. Although it is true that groups have a member attribute, it is not easy to connect to the group, add the distinguished name attribute of the user to the member attribute, call the setinfo() method, and finish. Rather, the process requires us to first connect to the group. Then, use the add() method to add the adsPath to the member attribute, and then, don't bother calling setinfo().

Begin the AddUserToGroup.ps1 script with the param() statement, supplying ...

Get Windows PowerShell™ Scripting Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.