Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to add user to a LDAP group with VB.net

Posted on 2008-10-21
2
1,792 Views
Last Modified: 2013-12-19
Need to know how to add a user to a group within AD using VS 2005 VB.net.  Trying to interface an application with AD to add the users to AD and then put them in a specific group.
0
Comment
Question by:fdenison
2 Comments
 
LVL 3

Accepted Solution

by:
Ricardo Elena earned 125 total points
ID: 22769189

these migth help
Dim directory As New DirectoryServices.DirectoryEntry("WinNT://" + Environment.MachineName + ",computer")
Dim new_user As DirectoryServices.DirectoryEntry = directoria.Children.Add("User1000", "user")
new_user.CommitChanges()
Dim groups As DirectoryServices.DirectoryEntry
groups = directory.Children.Find("Administrator", "group")
If groups.Name <> "" Then
MsgBox("Add....")
new_user.Invoke("Add", New Object() {new_user.Name.ToString})
MsgBox("Added.....")
Else
MsgBox("Nothing")
End If
0
 

Author Closing Comment

by:fdenison
ID: 31508257
Thank you for your input, your suggestion was helpful, we ended up having a permissions issue with AD your code helped us to write some error checking to find the issue.  Thank you.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question