#149818 - 2005-10-12 10:27 PM
Re: UDF to verify user name
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Your approach does not seem very efficient especially if you attempt this on a domain with many users.
You could even use the ADSI WinNT:// provider to bind to the expected account name. If you succeed then the account exists. Otherwise you will get an error.
|
|
Top
|
|
|
|
#149821 - 2005-10-12 10:41 PM
Re: UDF to verify user name
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Yes...there would seem to be a next step after someone enters a user ID. Maybe you should just proceed with whatever you intend and trap the resulting error if the process fails.
|
|
Top
|
|
|
|
#149823 - 2005-10-12 11:09 PM
Re: UDF to verify user name
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
I think you should stick with fnLDAPQuery(). If you get the hang of it, you'll find it a very powerful tool for querying Active Directory.
Code:
$aWhat = "sAMAccountname","ADsPath" $sSAM = $textbox1.text $sWhere = "(&(objectCategory=person)(objectClass=user)(SAMAccountname="+$sSAM+"))" $aResults = fnLDAPQuery($aWhat,,$sWhere) If UBound($aResults) < 0 MessageBox("User ID not found","Notice",64) $Label1.Width = 58 $Label1.Text = "User ID: " $TextBox1.Visible = "True" Exit (1) Else $aResults[0,0] ? ; The user's sAMAccountname $aResults[0,1] ? ; The user's ADsPath EndIf
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 1607 anonymous users online.
|
|
|