#87056 - 2002-07-27 04:18 AM
TranslateName() - Microsoft API bug
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
JensKalski ,I have read the BUG: Error 80072116 When You Use the Set Method of the NameTranslate API link you posted in the UDF thread. I can't fix a Microsoft bug. What is your specific problem. How are you using the the TranslateName() UDF? How are you being affected by the bug? [ 27 July 2002, 14:44: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#87057 - 2002-07-27 09:08 AM
Re: TranslateName() - Microsoft API bug
|
JensKalski
Starting to like KiXtart
Registered: 2000-12-13
Posts: 186
Loc: Germany
|
I have had problems to translate into a LDAP-path. Then I have tried to reproduce the problems with a little vbscript-program. And I get exactly the same error-messages as described in the kb-article.
_________________________
Jens Kalski
|
|
Top
|
|
|
|
#87058 - 2002-07-27 02:52 PM
Re: TranslateName() - Microsoft API bug
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Well that sounds like you have confirmed the Microsoft bug.
I have not had any problems myself. Can you avoid having the problem characters in your object names? Can you give me an example of your data and usage that fail?
|
|
Top
|
|
|
|
#87060 - 2002-07-27 07:51 PM
Re: TranslateName() - Microsoft API bug
|
JensKalski
Starting to like KiXtart
Registered: 2000-12-13
Posts: 186
Loc: Germany
|
Now I'm really and absolutely confused. It functions with some workstation-accounts and with some others it does not.
Is there an easier way to set the computerdescription in the active directory?
_________________________
Jens Kalski
|
|
Top
|
|
|
|
#87061 - 2002-07-27 08:42 PM
Re: TranslateName() - Microsoft API bug
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Please take a look at the code below. It successfully returns the DN for my computer and sets the description.
Please post your code so that we can take a look at why you are having problems. Based on what you stated. I would expect that either your database contains incorrect names or names that no longer exist in your domain. Have you checked the error codes when you do not get the results that you expected? code:
$DN = TranslateName (3, "", 3, "@Domain\@wksta$$", 1) ? "DN = " + $DN[0] ? "Error = " + $DN[1] ? "ErrorText = " + $DN[2]
$obj = GetObject("LDAP://@domain/" + $DN[0])
? "GetObject: @error @Serror"
; Enumerate ALL properties ; Uncomment to show all properties ;EnumObjProps($obj)
? "Computer Description:" + $obj.description $obj.description = "DSS Laptop" $obj.SetInfo
Function EnumObjProps($object) Dim $Class, $Schema, $Value, $property, $cont
$Class = GetObject($object.schema) ? "Class: " + $Class.Name ? "GUID: " + $Class.GUID ? "Implemented by: " + $Class.CLSID
If $Class.Container ? ? "Container Object" ? "Class Contains:" For Each $cont In $Class.Containment ? " " + $cont Next Else ? ? "Leaf Object" EndIf
? "Mandatory Properties in this Class: " For Each $property In $Class.MandatoryProperties ? " " + $property Next
? ? "Optional Properties in this Class: " For Each $property In $Class.OptionalProperties ? " " + $property Next EndFunction
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
|
|
Top
|
|
|
|
#87062 - 2002-07-28 05:50 AM
Re: TranslateName() - Microsoft API bug
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11631
Loc: CA
|
Howard,
Nice looking piece of code... Can't try it out right now, but I can't wait to try it out on Monday when I get back to work.
I hope it works as well as it looks.
|
|
Top
|
|
|
|
#87063 - 2002-07-28 06:25 PM
Re: TranslateName() - Microsoft API bug
|
JensKalski
Starting to like KiXtart
Registered: 2000-12-13
Posts: 186
Loc: Germany
|
I will also try it out tomorrow at work.
_________________________
Jens Kalski
|
|
Top
|
|
|
|
#87065 - 2002-07-28 06:58 PM
Re: TranslateName() - Microsoft API bug
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
Im with yeah buddy ! These people that don't work on the weekend - jeesh !
|
|
Top
|
|
|
|
#87066 - 2002-07-28 07:11 PM
Re: TranslateName() - Microsoft API bug
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
This is real bummer. The weekend is the the only time when I can really help out. You add code, offer help, and then wait to respond. And wait, and wait, and wait. Then on Monday, you're boss wants you to do his work and not the rest of the world's. [ 28 July 2002, 19:12: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#87068 - 2002-07-29 10:00 AM
Re: TranslateName() - Microsoft API bug
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11631
Loc: CA
|
I have too many bosses. I have one that pays my weekly paycheck, and one that pays other dividends.
I work from 08:00 to 03:00 almost 7 days a week right now. I'M TIRED Work for the mouse during the day and then work doing house remodeling till the wee hours of the morning. Don't have time for coding much right now.
|
|
Top
|
|
|
|
#87069 - 2002-07-29 11:33 AM
Re: TranslateName() - Microsoft API bug
|
JensKalski
Starting to like KiXtart
Registered: 2000-12-13
Posts: 186
Loc: Germany
|
Thanks for the code Howard. I have tested it at work and found that it works. I don't know, what mistakes I have made. I will code my script based on your script.
_________________________
Jens Kalski
|
|
Top
|
|
|
|
#87070 - 2002-07-29 01:49 PM
Re: TranslateName() - Microsoft API bug
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Jens, glad to hear that your problems seem to be behind you now.
|
|
Top
|
|
|
|
#87072 - 2002-07-30 03:26 AM
Re: TranslateName() - Microsoft API bug
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Hey DOC, you can find some documentation for the TranslateName UDF in the UDF Library.
|
|
Top
|
|
|
|
#87074 - 2002-07-30 04:00 AM
Re: TranslateName() - Microsoft API bug
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
The TranslateName function is the same code in the UDF library. The EnumObjProps was never posted in the Library.
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 837 anonymous users online.
|
|
|