Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

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

Download

Right click “Save as…”

Federal Developer Evangelist, Robert Shelton, takes you through a 8 minute walkthrough/demonstration of how to create a group in active directory with .NET and to add users to that group.  This demonstration is using the DirectoryServices namespace of the .NET framework.





You can find the code at my blog: http://sheltonblog.com 


My other Programming AD Screen Casts:
- Searching AD with .NET:
http://channel9.msdn.com/Showpost.aspx?postid=132740
- Adding users to Active Directory with .NET
http://channel9.msdn.com/showpost.aspx?PostID=130700
List of Group attributes for Active Directory:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adschema/adschema/c_group.asp
List of values for the groupType Attribuet:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adschema/adschema/a_grouptype.asp

~Robert

Tags:

Follow the Discussion

  • 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

  • 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
  • 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
  • That was cool thanks!. Code would be nice.
  • After a long time of looking i found a good app that demos a bunch of AD functions including adding user to group. get the free one.
    http://www.dotnetactivedirectory.com/
  • 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
  • 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
  • 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
  • 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.
  • 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.

  • Alexa AllinsonAlexa321 Hey its me.

    This has solved a problem for me too, I'm glad I found this page. I'm also pleased that I stumbled across discount voucher information.

  • I think it's a good idea to explore how an agent-isolated model can be used to simplify expressing "ownership" of the UI. It certainly seems worth exploring in some depth. Thesis.

  • Federal Developer Evangelist, Robert Shelton, takes you through a 8 minute walkthrough/demonstration of how to create a group in active directory with .NET and to add users to that group.  This demonstration is using the DirectoryServices namespace of the .NET framework..thanks for sharing your views..
     Free online games .
    Regards,


Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.