+ Post New Thread
Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
Web Development Thread, Query Active Directory through asp page in Coding and Web Development; Have a google round for ADSI + ASP. I've got some examples if you like for enumerating locations & computers ...
  1. #16

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,401
    Thank Post
    637
    Thanked 961 Times in 661 Posts
    Blog Entries
    2
    Rep Power
    319

    Re: Query Active Directory through asp page

    Have a google round for ADSI + ASP. I've got some examples if you like for enumerating locations & computers and users for password-resetting and our fancy Intranet page ("Welcome Mr. Such and such" and give them customised links depending on staff/student group).

  2. #17

    Join Date
    Jan 2006
    Location
    Hertfordshire
    Posts
    151
    Thank Post
    2
    Thanked 8 Times in 8 Posts
    Rep Power
    19

    Re: Query Active Directory through asp page

    Hi,

    I've done a lot of work on accessing Active Directory using ASP (more vb.net web application) and this is what I have been able to do:

    Add, Delete, Move and update user’s accounts
    Pull information about users from AD

    You can create shares but not set any Security Permissions, if someone knows differently please PM me.

    Lesson1
    Start a VB.NET Web Application

    Add a button to the form
    Add 5 text boxs' (txtuname,txtfname,txtsname,txtprofile,txtspath)

    Use this code for button 1

    Code:
    Dim strUsername = txtuname.Text
                Dim strFirstname = txtfname.Text
                Dim strSurname = txtsname.Text
                Dim strprofilepath = txtprofile.Text
                Dim strlogons = txtspath.Text
                Dim strDisplayname = strFirstname & strSurname
                CreateUser("LDAP://cn=Users,DC=domain,DC=local" &, txtfname.Text, txtsname.Text, txtuname.Text, txthdriveletter.Text, txtspath.Text)
    Add this SUB

    Code:
    Sub CreateUser(ByVal aContainer As String, ByVal strFirstname As String, ByVal strSurname As String, ByVal username As String, ByVal strhdrive As String, ByVal strlogons As String)
            Dim DSESearcher As DirectoryServices.DirectorySearcher = New DirectoryServices.DirectorySearcher()
            Dim RootDSE As String = DSESearcher.SearchRoot.Path
            RootDSE = RootDSE.Insert(7, "CN=Users,")
            Dim myDE As DirectoryServices.DirectoryEntry = New DirectoryServices.DirectoryEntry(aContainer)
    
            Dim myEntries As DirectoryServices.DirectoryEntries = myDE.Children
            Dim oUserDE As DirectoryServices.DirectoryEntry = myEntries.Add("CN=" + username, "user")
    
            oUserDE.CommitChanges()
    
    
            oUserDE.Properties("profilePath").Value = "\\<servername>\" & username & "\profile"
            oUserDE.Properties("scriptPath").Value = strlogons
            oUserDE.Properties("samACcountName").Value = username
            oUserDE.Properties("scriptPath").Value = strlogons
            oUserDE.Properties("userPrincipalName").Value = username
            oUserDE.Properties("description").Value = "User"
            oUserDE.Properties("pwdLastSet").Value = "0"
            oUserDE.Properties("givenName").Value = strFirstname
            oUserDE.Properties("sn").Value = strSurname
            oUserDE.Properties("displayName").Value = strFirstname & " " & strSurname
            oUserDE.Properties("description").Value = "User"
            oUserDE.Properties("givenName").Value = strFirstname
            oUserDE.Properties("sn").Value = strSurname
            oUserDE.Properties("homeDirectory").Value = "\\" & System.Configuration.ConfigurationManager.GetSection("MyAppSettings")("server") & "\" & username & "$" & "\files"
            oUserDE.Properties("homeDrive").Value = strhdrive
            oUserDE.CommitChanges()
    
        End Sub
    And that should alow you to add users to your AD (finger crossed)


    If I have time I'll post the search and display code. Please beware that this works on my domain and servers and i have not tested it on any other servers. Be careful of the word wrapping

    Tom

  3. #18
    Rozzer's Avatar
    Join Date
    Aug 2005
    Location
    South West
    Posts
    720
    Thank Post
    21
    Thanked 81 Times in 61 Posts
    Rep Power
    33

    Re: Query Active Directory through asp page

    Any chance you could release something for our needs

    Ross

  4. #19

    Join Date
    Jan 2006
    Location
    Hertfordshire
    Posts
    151
    Thank Post
    2
    Thanked 8 Times in 8 Posts
    Rep Power
    19

    Re: Query Active Directory through asp page

    Well I would love too but I'm not to sure the Partnership I work for would allow it because they are paying my salary and I’m developing the application at work.

    I'm working on two version, an ASP version which i've scaled back to searching for Users, Displaying user information and resetting passwords. I came accross some wired errors when i rolled the fall working application to IIS so I scaled it back. I would say this is 99.2% completed!!!

    The windows version is kicking a@@ at the moment and i might upload a lite version to ever growing Edugeek

    tom

  5. #20
    Rozzer's Avatar
    Join Date
    Aug 2005
    Location
    South West
    Posts
    720
    Thank Post
    21
    Thanked 81 Times in 61 Posts
    Rep Power
    33

    Re: Query Active Directory through asp page

    I understand but that does sound great

    Ross

SHARE:
+ Post New Thread
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Active Directory Alternative HOW-TO??
    By Joedetic in forum *nix
    Replies: 17
    Last Post: 26th January 2012, 10:46 PM
  2. PDA and Active Directory
    By localzuk in forum Windows
    Replies: 4
    Last Post: 10th October 2007, 03:54 PM
  3. Terrastation and active directory
    By edie209 in forum Windows
    Replies: 8
    Last Post: 27th September 2007, 02:46 PM
  4. Active Directory Explorer v1.0
    By PiqueABoo in forum Downloads
    Replies: 1
    Last Post: 16th July 2007, 10:02 PM
  5. DNS problem under Active Directory.
    By ArchersIT in forum Windows
    Replies: 6
    Last Post: 19th February 2007, 03:09 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •