Adding User To Group in Active-Directory on Windows 2008 Server Core R2

To add our new User to our Group, the add() method is used as shown below.


PS > $Connection = "LDAP://Server1/CN=NewGroup,OU=NewOU,DC=APA,DC=CORP"
PS > $Group = [adsi] $Connection
PS > $User = "LDAP://Server1/CN=jeapic,OU=NewOU,DC=APA,DC=CORP"
PS > $Group.Add($User)

If we look at the memebers of the group, our user will be added.


PS > $Group.member

CN=jeapic,OU=NewOU,DC=APA,DC=CORP

In the AD MMC Snapin, we can view the changes that we made.

servercore-08

And if we want to remove a user from a Group we can use the Delete() method.


PS > $Group.Remove($User)

Below is the code used in this post


$Connection = "LDAP://Server1/CN=NewGroup,OU=NewOU,DC=APA,DC=CORP"
$Group = [adsi] $Connection

$User = "LDAP://Server1/CN=jeapic,OU=NewOU,DC=APA,DC=CORP"

$Group.Add($User)

Rating 2.00 out of 5
[?]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Anti-Spam Protection by WP-SpamFree