Page 2 of 3 <123>
Topic Options
#117348 - 04/04/06 03:36 PM Re: LDAP
RodteX Offline
Fresh Scripter

Registered: 04/03/23
Posts: 22
Whel, a value of return is: $user_dep...
I don't understending...

Top
#117349 - 04/04/06 03:55 PM Re: LDAP
Chris S. Offline
MM club member
*****

Registered: 02/03/18
Posts: 2368
Loc: Earth
Run this and post your results...

Code:

$User = GetObject("LDAP://CN=USERNAME,OU=Users,DC=aaa,DC=com")
@ERROR " | " @SERROR ?
"Username: " $User.samAccountName ?
"Department: " $User.Department ?


Top
#117350 - 04/04/06 04:17 PM Re: LDAP
RodteX Offline
Fresh Scripter

Registered: 04/03/23
Posts: 22
Ok Chris, tks...
@error = -2147221014 | Moniker can not open file

Username: blanck
Department: blanck

Top
#117351 - 04/04/06 04:40 PM Re: LDAP
Chris S. Offline
MM club member
*****

Registered: 02/03/18
Posts: 2368
Loc: Earth
Please run this script and post the results...

Code:

Break On

$nul=SetOption("WrapAtEOL","On")

$FQDN = TranslateName (3,"",3,"@LDOMAIN\@USERID",1)
If @ERROR
@ERROR " | " @SERROR ?
Else
"Fully Qualified Domain Name: " + $FQDN ?

$User = GetObject("LDAP://" + $FQDN)
If @ERROR @ERROR " | " @SERROR ? EndIf
"Username: " $User.samAccountName ?
"Department: " $User.Department ?
EndIf

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")
if @Error = 0
$NameTranslate.Init ($InitType, $BindName)
if @Error = 0
$NameTranslate.Set ($LookupNameType, $LookupName)
if @Error = 0
$ReturnName = $NameTranslate.Get($ReturnNameType)
endif
endif
endif
$TranslateName = $ReturnName
If @ERROR<0 Exit VAL("&"+Right(DecToHex(@ERROR),4)) EndIf
Endfunction


Top
#117352 - 04/04/06 04:48 PM Re: LDAP
Howard Bullock Offline
KiX Supporter
*****

Registered: 00/09/15
Posts: 5809
Loc: Harrisburg, PA USA
I find that:
GetObject("LDAP://CN=USERNAME,OU=Users,DC=aaa,DC=com")

will not work when executing this code on a client computer unless you also specify a domain or server name as part of the LDAP string.


GetObject("LDAP://NetBIOSDomain/CN=USERNAME,OU=Users,DC=aaa,DC=com")
or
GetObject("LDAP://server/CN=USERNAME,OU=Users,DC=aaa,DC=com")

This tells where the LDAP bind should take place.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#117353 - 04/04/06 06:28 PM Re: LDAP
RodteX Offline
Fresh Scripter

Registered: 04/03/23
Posts: 22
Hey Chris, very tks to help me...
Error in execute script is:
9 | the address of the blocks of storage control is invalid

And Howard, this option not valid, no map...

Top
#117354 - 04/04/06 06:46 PM Re: LDAP
ShaneEP Moderator Offline
MM club member
*****

Registered: 02/11/29
Posts: 1984
Loc: Tulsa, OK
I have found that I have to use @FullName to get results...The USERID does not work. Not sure if it is just my enviroment...But if not, then you all are telling him to use USERID which may not be working.
Top
#117355 - 04/04/06 07:50 PM Re: LDAP
Chris S. Offline
MM club member
*****

Registered: 02/03/18
Posts: 2368
Loc: Earth
Well, with the TranslateName UDF we are inputing the user information using WINNT and attempting to translate to a fully-qualified LDAP path.

I think at this point we need some more basic information.

What is the operating system of the computer running the script?

What is the directory environment (2000 AD, 2003 AD, NT 4)?

Top
#117356 - 04/04/06 07:54 PM Re: LDAP
RodteX Offline
Fresh Scripter

Registered: 04/03/23
Posts: 22
AD 2003
Top
#117357 - 04/04/06 07:58 PM Re: LDAP
Chris S. Offline
MM club member
*****

Registered: 02/03/18
Posts: 2368
Loc: Earth
and...

What is the operating system of the computer running the script?

Top
#117358 - 04/04/06 08:04 PM Re: LDAP
RodteX Offline
Fresh Scripter

Registered: 04/03/23
Posts: 22
Windows 98, Windows 2000 and Windows XP (Brazilian version too)
Top
#117359 - 04/04/06 08:12 PM Re: LDAP
Chris S. Offline
MM club member
*****

Registered: 02/03/18
Posts: 2368
Loc: Earth
Which OS are you testing on right now?

ADSI is not installed on Windows 98.

Top
#117360 - 04/04/06 08:22 PM Re: LDAP
RodteX Offline
Fresh Scripter

Registered: 04/03/23
Posts: 22
Win 2K Pro
Top
#117361 - 04/04/06 08:29 PM Re: LDAP
Chris S. Offline
MM club member
*****

Registered: 02/03/18
Posts: 2368
Loc: Earth
Are you able to run the script the NTDOC talked about in this post: http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Board=UBB13&Number=116164&Forum=UBB13&Words=KiXforms%20-%20Active%20Directory%20Browser&Match=Entire%20Phrase&Searchpage=0&Limit=25&Old=1week&Main=116161&Search=true#Post116164

Top
#117362 - 04/04/06 09:08 PM Re: LDAP
RodteX Offline
Fresh Scripter

Registered: 04/03/23
Posts: 22
Whel....!!!!
I don't no...
Error in line 29 and 43 and 44...
I give up

Top
#117363 - 04/04/06 09:19 PM Re: LDAP
Sealeopard Offline
KiX Master
*****

Registered: 01/04/25
Posts: 11161
Loc: Boston, MA, USA
I just copied the script and ran it. There's nothign wrong with the script, which makes me believe that you didn't copy it correctly. See the FAQ Forum on how to copy/paste code form the board.
_________________________
There are two types of vessels, submarines and targets.

Top
#117364 - 04/04/06 09:23 PM Re: LDAP
RodteX Offline
Fresh Scripter

Registered: 04/03/23
Posts: 22
Hey Sealeopard,
I need CTRL+C/CTRL+V, but i don't understend, no work...
Sorry...and tks for help

Top
#117365 - 04/04/06 09:28 PM Re: LDAP
ShaneEP Moderator Offline
MM club member
*****

Registered: 02/11/29
Posts: 1984
Loc: Tulsa, OK
Try this....

Click on the the link below and download the script and run it. As long as you have the kixforms.dll registered it should work fine.

AD_Browser.kix

Once you run the AD_Browser.kix script you should be able to browse to a user and copt the correct LDAP path of that user.

Top
#117366 - 04/04/06 09:39 PM Re: LDAP
ShaneEP Moderator Offline
MM club member
*****

Registered: 02/11/29
Posts: 1984
Loc: Tulsa, OK
Better yet...Try downloading this script. It is a stripped down version of the script that Chris posted above using the TranslateName UDF. That way it will work for any user no matter their AD directory.

ldap_dept.kix

The only thing you have to change in the script is the server to map the drive to...It is currently \\server\ and you will need to change this to your server name. Besides that there should be no needed changes. See if it works.

Top
#117367 - 04/04/06 10:17 PM Re: LDAP
Kdyer Offline
KiX Supporter
*****

Registered: 01/01/03
Posts: 6241
Loc: Tigard, OR
A tip..

Copy the script to the clipboard.. Paste into Word/WordPad. Copy from Word/WordPad, and paste into NotePad. The code formatting should come out right.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
Page 2 of 3 <123>


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

Who's Online
1 registered (Shawn) and 90 anonymous users online.
Newest Members
B1GHawkeyes, GeoHamm, register, Marcus_Dunne, stuvwx656262
17397 Registered Users

Generated in 0.114 seconds in which 0.02 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