|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How Can I get User Information using ADSI
Originally posted by : sameers (sameers@theangrycoder.com)I want to get the User Info like user name and Computer Name of the User. I came to know that ADSI can Do this. I want to use it with ASPwith thanks sameerssameers@theangrycoder.com
|
|
#2
|
|||
|
|||
|
Originally posted by : Vishvas (vishvas_kumar@yahoo.com)You can do something like this.Dim UserDim UserNameDim DomainDomain = "Domain_Name"UserName = "USER_NAME"Set User = GetObject("WinNT://" & Domain & "/" & UserName & ",user")Response.Write User.FullnameHope it helps.------------sameers at 10/19/2001 3:46:32 PMI want to get the User Info like user name and Computer Name of the User. I came to know that ADSI can Do this. I want to use it with ASPwith thanks sameerssameers@theangrycoder.com
|
|
#3
|
|||
|
|||
|
'4.1 Display User Fullname
Sub PullUserFullname(strDomain,strUser) Dim User Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user") Response.write User.Fullname End sub '4.11 Display User Profile Path Sub PullUserProfilePath(strDomain,strUser) Dim User Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user") Response.Write User.Profile End Sub '4.15 Display User Account Expiration Date (NT 4.0 only) Sub PullUserAccountExpireDate(strDomain,strUser) Dim User Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user") Response.Write User.AccountExpirationDate End Sub '4.17 Display User Last Login (NT 4.0 only) Sub PullUserLastLogin(strDomain,strUser) Dim User Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user") Response.Write User.LastLogin End Sub '4.18 Display User Last Logoff (NT 4.0 only) Sub PullUserLastLogoff(strDomain,strUser) Dim User Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user") Response.Write User.LastLogoff End Sub '4.10 Display User Account Type Sub PullUserAccountType(strDomain,strUser) Dim User Dim Flags Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user") Flags = User.Get("UserFlags") Response.write Flags And &H100 '// 0 Means that account is GLOBAL End sub '5.2 Display Which Group a User is Listed in Sub DispUserInWhichGroup(strDomain,strGroup,strUser) Dim Group Dim User Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user") For Each Group in User.Groups Response.Write (Group.Name & "<br>") Next End Sub |
|
#4
|
|||
|
|||
|
This particular thread was pretty useful for getting user details from ADSI. Not very easy to find anything on ADSI on the Net.
Is there also a way to get the user's email address. I am sure there must be a way. |
|
#5
|
|||
|
|||
|
Hi,
I have some problem in accessing the Active Directory, i want to make some web based application that user can booking the computer that connected in the active directory. I need to know how to access Account in the user property, and get the user logon name & password. Setting logon hours (what day and setting logon session by per-hours and determine which computer he/she can logon to After the hours that he/she chose their session is automatically disconected) It's all in the user-> property Until now i only can get the list of the user and computer, and the script is like this (i'am using win2000) ' user.asp <<A href="mailto:%@LANGUAGE="VBSCRIPT">%@LANGUAGE="VBSCRIPT" CODEPAGE="CP_ACP"%> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <% Dim Conn, strRS, RS, strConn Set Conn = Server.CreateObject("ADODB.Connection") Set RS = Server.CreateObject("ADODB.Recordset") Conn.Provider = "ADsDSOObject" strConn = "Active Directory Provider" Conn.Open strConn strRS = "SELECT givenname FROM 'LDAP://DOMAIN_NAME' WHERE objectClass = 'user' ORDER by name " RS.Open strRS, Conn,1,1 While RS.EOF = False 'f ("givenname"!=NULL) Response.Write "Name:" &RS("givenname")& "<br>" RS.MoveNext 'end if Wend %> </body> </html> computers.asp <<A href="mailto:%@LANGUAGE="VBSCRIPT">%@LANGUAGE="VBSCRIPT" CODEPAGE="CP_ACP"%> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <% Dim Conn, strRS, RS, strConn Set Conn = Server.CreateObject("ADODB.Connection") Set RS = Server.CreateObject("ADODB.Recordset") Conn.Provider = "ADsDSOObject" strConn = "Active Directory Provider" Conn.Open strConn strRS = "SELECT name FROM 'LDAP://DOMAIN_NAME' WHERE objectClass = 'computer' ORDER by name " RS.Open strRS, Conn,1,1 While RS.EOF = False 'f ("givenname"!=NULL) Response.Write "Name:" &RS("name")& "<br>" RS.MoveNext 'end if Wend %> </body> </html> I just need to know how to get -user name logon -password -logon hours -logon onto etc from account and also -end a disconnected session -active session limit -idle session limit etc from session Thank's |
|
#6
|
|||
|
|||
|
Thank's for the helps
But now i still confused about how to access the user log on and setting the binary for logon permitted and logon denied from ASP I've tried Query name like this but it's return error select logonhours from 'LDAP://DOMAIN_NAME' WHERE objectClass = 'user' also the user logon to i want to add computer to the list of user logon to but it's also return error The field name for Logon hours and logon to in LDAP are : Logon hours: logonHours Syntax : Binary Description :Weekdays and hours in one-hour increments during which the user is allowed to log on Logon To : userWorkstation Syntax : Text Description : A list of computer NetBIOS names that the user is allowed to log on to. -------------------------------------------------------------------------------- Does anyone have a book or file about ADSI programming with ASP?? please send me a file about that to homer@inf.its-sby.edu thank's sinantrya |
|
#7
|
|||
|
|||
|
Sub PullUserLogonHourRestriction(strDomain,strUser)
Dim User Dim RegTime Dim Restrict Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user") For Each RegTime In User.LoginHours If RegTime < 255 Then Restrict = True Next Response.write Restrict End Sub I've tried the script up there, but it has an error that variable RegTime and User.loginHours does't have the same type or type mismatch But i read that user.loginhors has binary type but i've tried to change the type of variable regtime to boolean but it have no effect Thanks |
![]() |
| Viewing: ASP Free Forums > Programming > HTML, JavaScript And CSS Help > How Can I get User Information using ADSI |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|