Hi,
With the following code I can add a group to a current user in AD, the problem seems to be that I would like to check what groups the user is in first before I add it. I can't seem to do so.
How can I get this information?
VB Code:
Dim objConn As DirectoryEntry Dim objCurrentUser As DirectoryEntry Dim objGroup As DirectoryEntry Dim strConn As String strConn = "WinNT://" + Environment.MachineName objConn = New DirectoryEntry(strConn) objCurrentUser = objConn.Children.Find("MrFlibble", "user") objGroup = objConn.Children.Find("Users", "group") 'add user to group If objGroup.Name <> "" Then objGroup.Invoke("Add", New Object() {objCurrentUser.Path.ToString()}) End If
Thanks in advance!


Reply With Quote