How can I slect a AD user whit in a asp page and ADSI

How can I slect a AD user whit in a asp page and ADSI

Post by mjellesm » Thu, 12 Jun 2003 20:03:29



How can I slect a AD user whit in a asp page and ADSI

I'am looking for a ASP script that show all users from a AD-Domain
And that i can select one of them to change a propertie (disable, ore
rename)

--
Direct access to this group with http://web2news.com
http://web2news.com/?microsoft.public.adsi.general

 
 
 

How can I slect a AD user whit in a asp page and ADSI

Post by Max L. Vaughn [MSF » Sat, 14 Jun 2003 03:18:19


There is nothing canned and ready to go to do this.

You can setup a simple LDAP ADO query to find all the users in the domain, then populate some type of drop down or tree control that would allow you to
select a user from it.

below is a simple VBS that will return all the users from a domain using an LDAP dialect query and the ADSI ADO provider.

Sincerely,
Max Vaughn [MS]
Microsoft Developer Support

Disclaimer: This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use.

'*********************************************************************
' THIS SCRIPT IS PROVIDED AS AN ExAMPLE OF HOW TO QUERY THE ACTIVE DIRECTORY
' AND OBTAIN ALL OF THE USER OBJECTS WITHIN THE DIRECTORY.
' THE SAMPLE ILLUSTRATES HOW TO BIND TO THE RETURNED RESULTS
' AND DISPLAY SPECIFIC INFORMATION ABOUT EACH OBJECT
'
' THIS CODE MAKES NO ATTEMPT TO PERFORM PROPER ERROR CHECKING!
' THE SAMPLE USES THE RootDSE OBJECT TO DETERMINE THE
' DC NOMENCLATURE FOR THE LDAP SEARCH.
'
'
'
dim RootDse
set RootDse = GetObject("LDAP://RootDSE")
strdn = RootDse.Get("defaultNamingContext")
WScript.Echo "Preparing to query for all users in Domain: " & vbcrlf & strdn
WScript.Echo
'
' Create the objects needed to perform the ADO query
'
Set con = CreateObject("ADODB.Connection")
con.Provider = "ADsDSOObject"
con.Open "Active Directory Provider"
'
'Set Query syntax
'
Set Command = CreateObject("ADODB.Command")
Set Command.ActiveConnection = con
'
' Here is the LDAP query string.  
' Change the "ou=Test Comp," to a container in your
' directory.  If you want to start at the root, just remove
' the "ou=Text Comp" string.
'
Command.CommandText = "<LDAP://ou=test comp,"&strDN&">;(&(objectclass=user)(objectcategory=person));AdsPath, cn; subTree"
'
' With so many results to be returned, change the search to a paged search.
'
Command.Properties("Page Size") = 99
'
' Execute the query
'
Set rs = Command.Execute
'
' Loop through the records set and display the users'
' ADsPath and Common Name
'
' Commented out code illustrates how to force the users to change
' their password at the next login.
'
While Not rs.EOF
   wscript.echo rs.Fields("cn").Value
   WScript.echo rs.Fields("AdsPath").Value
   rs.MoveNext
Wend
WScript.Echo "DONE............................"
'*********************************************************************

 
 
 

1. Can't access AD via LDAP & ADSI from ASP.NET (VB) page

Hey,
This ADSI stuff is starting to turn into a headache!
I am attempting to obtain attribute values of users from AD, eg Fullname,
Phone number, etc, but I am having problems binding to the object.
Binding to the entire domain works fine: (code...)

User = GetObject("LDAP://DC=qccnt, DC=au")

But, binding directly to a OU or a user or a computer account just wont
work:

User = GetObject("LDAP://OU=USERS, DC=qccnt, DC=au")
User = GetObject("LDAP://CN=USERS, DC=qccnt, DC=au")
User = GetObject("LDAP://CN=Administrator, OU=USERS, DC=qccnt, DC=au")

It returns the error: Unable to create ActiveX object.....     but
why?!?!?!?!
All help is greatly appreciated, THANKS!!!

2. IP printing

3. Listing users and group in AD thru ADSI and ASP.NET

4. Battle Creek backs down on ORBZ charges?

5. Enabling users to change their password via web page (ASP/ADSI)

6. Gmemusage shows processes gobblin' too much?

7. Adding/Removing users to AD groups with C# ASP.NET page

8. Inter application data transfer

9. Creating WinNT 4.0 User with ADSI in asp page

10. ASP/ADSI Page to Change passwords

11. ADSI Search with ADO via an ASP Page

12. creating groups in AD from ASP pages continue from the previous post

13. Problem: Cannot read AD atribute in ASP page