IADsGroup Method: Add

Add
(
NewMember As String
);

Parameters

[in] String NewMember
Name of the user to be added to a group, for example, John.

Description
Adds a new member to a group, usually a user or another global group (in case of local group).

Remarks
If you are adding a user or a group to a local group then you must give the fully qualified name, for example, "DomainName\User" for a global user and "ComputerName\User" for a local user.

Example

Dim GroupObject As IADsGroup
Set GroupObject = GetObject("NTDS://YourDomainName/GroupName")
GroupObject.Add "UserOfDomain"

 

Note:  You cannot add a group to a global group.
The parameter for Add in case of local group could be in any of the following formats:

<DomainName>\<username>
<DomainName>\<groupname>
<ComputerName>\<localusername>

 

See Also