Adding Groups (and users to groups) to Active Directory with .NET

Sign in to queue

The Discussion

  • User profile image
    flabbergast​ed
    While it's nice of you to help people by posting this webcast, I really think that it's completely worthless that there is no source code that can be downloaded. It's really hard to remember everything from the webcast, and it's even harder to copy/paste from windows media player!!! Perplexed

  • User profile image
    Robert Shelton
    Good feedback, flabbergasted...I will check to see if I still have the sample code and if so, I will post the code in the presentation section (left navigation) of http://www.federaldeveloper.com.  Going forward, I will make this a part of my process, to make it easier for everyone.

    Again, thanks for stating the obvious.  Sometimes the obvious, isn't so obvious! Wink
  • User profile image
    Robert Shelton
    I checked and I don't have that demo saved anywhere, but I did have the original "full" demonstration application that I took the smaller demos for the screencast from.  For those who are interested, it will be on http://www.federaldeveloper.com on the left hand navigation under presentations, under Robert Shelton. 

    Again, in the future, I will save the demo code and posted it with a link within the Screencast description form.

    ~Robert
  • User profile image
    Levy7
    That was cool thanks!. Code would be nice.
  • User profile image
    atomicx
    I thought the screen show was great it is what I was looking for.

    I'm having trouble finding the source code for the project.  Could you post a link to the source code?

    Thanks
    Troy
  • User profile image
    atomicx
    I'm also having an issue with the DirectoryEntry.Exists command it keeps telling me that

    "Logon failure: unknown user name or bad password."

    I would have thought that adUserFolder object would contain the connection information since I specified at the beginning.


    Any ideas?

    Thanks
    Troy
  • User profile image
    LarryZonka
    Exactly what I'm looking for thanks!

    Has anyone resolved the Logon failure: unkown user name or bad password?  I'm having the same issue, only when I used the Exists function.

    Here is an screen shot of my issue.
    http://picasaweb.google.com/BlogZonka/CodeScreenshots/photo#5057082651973825346

    I know it isn't permission problem, because if I comment out the line that causes the error:

    // if (DirectoryEntry.Exists(newUser.Path)) return;

    Then it works fine, but if the user doesn't exist in AD.

    In other words, I can commit with no problems.

    Just for the sake of permissions, I even logged in as administrator, still the same problem.

    Thanks
  • User profile image
    LarryZonka
    We just discovered why I was getting the error.

    I was trying to use the DirectoryEntry.Exist() function on a non trusted computer to the test AD Domain Controller.

    Since you pass the username and password when adding the user to the User group, the account is enough for the DirectoryEntry object to validate with AD.

    So remember that when testing on a system to make sure that system is part of the domain.
  • User profile image
    Madness
    I wish I had found this page 3 days ago.  The code sample that I was working off of was this: http://msdn2.microsoft.com/en-us/library/ms180904(vs.80).aspx">http://msdn2.microsoft.com/en-us/library/ms180904(vs.80).aspx

    That says:

    The following Visual Basic .NET example demonstrates how to add a single member to a group.

    Visual Basic
    ' Bind to the group.
    Dim group As New DirectoryEntry(groupDN)
    
    ' Add the user to the group.
    group.Properties("member").Add(userDN)
    
    ' Commit the changes to the group.
    group.CommitChanges()
    

    Can anyone tell me what this sample is supposed to do? Is it incorrect? I tried to post Community Content that it didn't work and I successfully used group.invoke("Add",userDN) instead. But my browser just goes into some kind of loop.

  • User profile image
    Sara

    I'm an SEO specialist in SEO company (linksmanagement.com). And it is useful for me to find out how to create a group in active directory with .NET and to add users to that group.

Add Your 2 Cents