Page 1 of 1 1
Topic Options
#193958 - 2009-05-20 12:57 PM AD Display Name
pSyToR Offline
Fresh Scripter

Registered: 2009-03-12
Posts: 8
Loc: Dubai, UAE
Hello everyone !!!

I'm in need of help...

I have a list of users... and i would like to find their "Display Name" in the AD any ways of doing simply ?

Thanks in advance

Top
#193963 - 2009-05-20 02:13 PM Re: AD Display Name [Re: pSyToR]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Yes, do a search for LDAPQuery()
_________________________
Today is the tomorrow you worried about yesterday.

Top
#193964 - 2009-05-20 02:18 PM Re: AD Display Name [Re: pSyToR]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
This works for me.
All you need to do is change the usernames in the $usernames array.
Also have a look at Basic Scripting » LDAP Query Again. The script below is taken from what Kdyer (aka Kent) posted there.

 Code:
Break on

$usernames = "User1", "User2", "User3"

For Each $username in $usernames
	$userhome = TranslateName(3, "", 3, @LDomain + "\" + $username, 1)
	$userinfo = GetObject("LDAP://" + $userhome[0])
	? "Display Name: " + $userinfo.displayName
Next

? 'Press a key...'
Get $

;========== DO NOT MODIFY ANYTHING BELOW THIS LINE
;========== THIS IS A UDF AND IT COMES READY FOR USE
;
; TranslateName function authored by Howard A. Bullock
Function TranslateName($InitType, $BindName, $LookupNameType, $LookupName, $ReturnNameType)
	Dim $InitType, $BindName, $LookupNameType, $LookupName, $ReturnNameType
	Dim $NameTranslate, $ReturnName, $Error, $ErrorText
	$Error = 0
	$ErrorText = ""
	$ReturnName = ""
	$NameTranslate = CreateObject("NameTranslate")
	$Error = @error
	$ErrorText = @serror
	If $Error = 0
		$NameTranslate.Init($InitType, $BindName)
		$Error = @error
		$ErrorText = @serror
		If $Error = 0
			$NameTranslate.Set($LookupNameType, $LookupName)
			$Error = @error
			$ErrorText = @serror
			If $Error = 0
				$ReturnName = $NameTranslate.Get($ReturnNameType)
				$Error = @error
				$ErrorText = @serror
			EndIf
		EndIf
	EndIf
	$TranslateName = $ReturnName, $Error, $ErrorText
EndFunction
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#193966 - 2009-05-20 02:45 PM Re: AD Display Name [Re: Mart]
pSyToR Offline
Fresh Scripter

Registered: 2009-03-12
Posts: 8
Loc: Dubai, UAE
Thanks A LOT !!!

I Think I'll be able to do something with that ;\)

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 581 anonymous users online.
Newest Members
Audio, Hoschi, Comet, rrosell, PatrickPinto
17880 Registered Users

Generated in 0.028 seconds in which 0.012 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org