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:
  1. Dim objConn As DirectoryEntry
  2.                     Dim objCurrentUser As DirectoryEntry
  3.                     Dim objGroup As DirectoryEntry
  4.                     Dim strConn As String
  5.  
  6.                     strConn = "WinNT://" + Environment.MachineName
  7.                     objConn = New DirectoryEntry(strConn)
  8.                     objCurrentUser = objConn.Children.Find("MrFlibble", "user")
  9.                     objGroup = objConn.Children.Find("Users", "group")
  10.  
  11.                     'add user to group
  12.                     If objGroup.Name <> "" Then
  13.                         objGroup.Invoke("Add", New Object() {objCurrentUser.Path.ToString()})
  14.                     End If

Thanks in advance!