Page 2 of 2 <12
Topic Options
#140798 - 2005-06-02 09:27 PM Re: Problem with TranslateName
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
The short answer is to convert that ADO VBS code to KiX code and use it instead of TranslateNAme if that is good enough for you.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#140799 - 2005-06-03 05:28 PM Re: Problem with TranslateName
oobnuker Offline
Getting the hang of it

Registered: 2003-12-09
Posts: 87
Loc: Oxford, CT
Quote:

Give fnLDAPQuery() a try. Here is an example for the current workstation...

Code:

; == Return the distinguishedName for the computer ===================
$aAttributes = "distinguishedName"
$sADsPath = "LDAP://"+GetObject("LDAP://rootDSE").Get("defaultNamingContext")
$strFilter = "(&(objectClass=Computer)(Name="+@WKSTA+"))"

$aResults = fnLDAPQuery($aAttributes,$sADsPath,$strFilter)
@ERROR " | " @SERROR ?

For Each $Result in $aResults
$Result ?
Next






Chris - the above code works for the DN of the current workstation, but for some reason I can't get the same info for the currently logged in user using this code that I grabbed from another thread:

Code:

; == Return the distinguishedName for the user ===================
$aAttributes = "distinguishedName"
$sADsPath = "LDAP://"+GetObject("LDAP://rootDSE").Get("defaultNamingContext")
$strFilter = "(&(objectClass=User)(Name="+@USERID+"))"

$aResults = fnLDAPQuery($aAttributes,$sADsPath,$strFilter)
@ERROR " | " @SERROR ?

For Each $Result in $aResults
$Result ?
Next



I get a 0 | Operation Completed Successfully, but no information is displayed. Any ideas? I am thinking of just going this route because it appears to work on the users that are having issues, and I would much rather stay within KiX rather than shelling out to VBS in the event things don't work - which is what I am doing now.
_________________________
-- oobnuker - .KIX hack - no really.

Top
#140800 - 2005-06-03 09:49 PM Re: Problem with TranslateName
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Try changing the filter from Name to sAMAccountName...

Code:

$strFilter = "(&(objectClass=User)(sAMAccountName="+@USERID+"))"


Top
#140801 - 2005-06-06 01:23 PM Re: Problem with TranslateName
oobnuker Offline
Getting the hang of it

Registered: 2003-12-09
Posts: 87
Loc: Oxford, CT
Quote:

Try changing the filter from Name to sAMAccountName...

Code:

$strFilter = "(&(objectClass=User)(sAMAccountName="+@USERID+"))"






This worked perfectly. Thanks!
_________________________
-- oobnuker - .KIX hack - no really.

Top
Page 2 of 2 <12


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

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.099 seconds in which 0.073 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