#113690 - 2004-02-10 02:07 PM
Re: Can not get LDAP query to work.
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
try: $UserProperties = GetObject("LDAP://ldap.home.com/"+$ldap[0]) Notice the addition of the "/" after the domain.
|
|
Top
|
|
|
|
#113692 - 2004-02-10 02:46 PM
Re: Can not get LDAP query to work.
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Please use @error and @Serror to return the error of the GetObject. You should also try outputing each of your variables to see that they contain what you think they should.
$TextBox.Text is not a valid variable name. Are you using Kixforms?
This code works for me using Kix32. Please start with this for testing and let me know the result. Code:
break On ? @kix $TextBox = 'domain1\user1' ? $TextBox $ldap = TranslateName(1, @domain, 3, $TextBox, 1) ? $ldap ? ? "LDAP://tycoelectronics/" + $ldap $UserProperties = GetObject("LDAP://domain1/"+$ldap) ? "@error @serror" ? $userProperties.SAMAccountName
Function TranslateName ($InitType, $BindName, $LookupNameType, $LookupName, $ReturnNameType) Dim $NameTranslate, $ReturnName
$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) if @Error <> 0 Writelog("TranslateName: Get error " + @error + " " + @serror) Writelog("TranslateName: (" + $InitType + ", " + $BindName+ ", " + $LookupNameType + ", " + $LookupName + ", " + $ReturnNameType + ")") endif else Writelog("TranslateName: Set error " + @error + " " + @serror) Writelog("TranslateName: (" + $InitType + ", " + $BindName+ ", " + $LookupNameType + ", " + $LookupName + ", " + $ReturnNameType + ")") endif else Writelog("TranslateName: Init error " + @error + " " + @serror) Writelog("TranslateName: (" + $InitType + ", " + $BindName+ ", " + $LookupNameType + ", " + $LookupName + ", " + $ReturnNameType + ")") endif else Writelog("TranslateName: CreateObject error " + @error + " " + @serror) endif $TranslateName = $ReturnName Endfunction
|
|
Top
|
|
|
|
#113695 - 2004-02-10 08:19 PM
Re: Can not get LDAP query to work.
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Now we are getting somewhare. 
TranslateName: Init error -2147352567 COM exception error "Init" ((null) - (null)) [-2147352567/80020009]
Means that the translate name function could not init the COM object using "ResourceDomain" (@domain). What happens if you use the Netbios name of the account domain where the account lives? By the way...you are executing this script under the security contextr of an active directory user account that has access to this domain - right?
You can try using different binding values.
bind to the logon domain: $Name2 = TranslateName (1, @LDomain, 3, $Name1, 1)
bind to a server: $Name2 = TranslateName (2, "\\server", 3, $Name1, 1)
Is your resource domain a W2K domain in the forest?
|
|
Top
|
|
|
|
#113699 - 2004-02-11 05:49 PM
Re: Can not get LDAP query to work.
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Where do we stand on the testing of different TranslateName bindings? Any success? You process should work if the script can return the DN for use in the GetObject call.
Checklist: 1. execute code under and Active Directory account. 2. execute code from a computer that is a member of the AD forest. 3. report results.
|
|
Top
|
|
|
|
#113701 - 2004-02-11 07:49 PM
Re: Can not get LDAP query to work.
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
TranslateName was developed to ease the use of LDAP with active directory. It's intended purpose is accept the domain\user name format and then return the workstation's or user's "Canonical Name" or "Distinguished Name". Neither of these seem like they would apply to you if you are referencing a user account on a NT4 domain.
Examples: Code:
Wksta Canonical Name.....: gb.tyco.com/Organisations/750-Swindon/OnSite/GBS0217 Wksta Distinguished Name.: CN=GBS0217,OU=OnSite,OU=750-Swindon,OU=Organisations,DC=gb,DC=tyco,DC=com User Canonical Name....: tyco.com/0001 - Tyco Electronics/0401 - Europe-Mideast-Africa/0414 - Northern Europe (Area)/0433 - Tyco Electronics UK Limited/user64 User Distinguished Name: CN=user64,OU=0433 - Tyco Electronics UK Limited,OU=0414 - Northern Europe (Area),OU=0401 - Europe-Mideast-Africa,OU=0001 - Tyco Electronics,DC=tyco,DC=com
NT4 is not an LDAP server and does not understand NameTranslate method. Please see: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/iadsnametranslate.asp
If you could better describe what you wish to accomplish, I may be better able to assist you. Is the LDAP server you wish to query a Windows 2000 domain controller? Why are you trying to look up LDAP properties on an NT4 account (or did I misunderstand you)?
In your original post you reference "ldap.home.com". What kind of server is this? What is your client operating system? IS ADSI installed?
|
|
Top
|
|
|
|
#113704 - 2004-02-12 07:44 PM
Re: Can not get LDAP query to work.
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I think that you are using an OLD URL. Please click the link in my signature line to access my web site and navigate from there.
|
|
Top
|
|
|
|
#113708 - 2004-02-17 11:02 PM
Re: Can not get LDAP query to work.
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
If you can do this with Outlook Express, I would suspect you should be able to do it in KiXtart if there is an appropriate COMable LDAP interface to your Unix LDAP server. I am not sure if ADSI will work or not, but if Outlook Express can do it the pieces should exist to accomplish the goal.
Unfortunately I do not know where to begin since I have no thing to test...
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1057 anonymous users online.
|
|
|