Page 1 of 1 1
Topic Options
#133687 - 2005-02-11 07:40 PM ADSI Error Codes
Bonji Offline
Starting to like KiXtart

Registered: 2001-09-28
Posts: 169
Loc: Virginia
I am unable to get the COM error returned to have any meaning as far as ADSI errors are concerned. I am familiar with how codes should be translated, and I even found the fnCOMErr() UDF that simplifies it. However, I can't get a meaningful error returned that tells me why a procedure failed.

Here's an example. Upon trying to create a new user that already exists, KiX returns the following error:
-2147352567. Upon translation to Hex and then translating the last four chars back to decimal, the resulting answer is 9. I can't find where this has any meaning. I've even looked at matching the hex value (80020009), but I can't make progress there either.

Does anyone have any insight?

Top
#133688 - 2005-02-11 07:48 PM Re: ADSI Error Codes
Bonji Offline
Starting to like KiXtart

Registered: 2001-09-28
Posts: 169
Loc: Virginia
Something I've noticed researching this error stuff. There are a lot of COM errors that return this exact value doing different functions. Sup wit dat?
Top
#133689 - 2005-02-11 08:01 PM Re: ADSI Error Codes
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
See if this helps at all

Active Directory Services Interface Error Codes in Windows 2000

Error Codes for ADSI 2.5

How to Trap ADSI Errors

Top
#133690 - 2005-02-11 08:43 PM Re: ADSI Error Codes
Bonji Offline
Starting to like KiXtart

Registered: 2001-09-28
Posts: 169
Loc: Virginia
I had already seen the last two links you mentioned. I am probably missing something, but the crux of my problem appears to be that I can't make 9 mean anything in the land of ADSI errors.

In the trapping ADSI error example, I can never get the error facility to return a code that can be found on the tables you mention in your other two links. In that example it could return &H800708B0 (the error I would expect), but I am unable to get it to return such (either utilizing decimal or hexadecimal values).

Maybe my method is bad? Here's the code I use to create the user...

Code:

$sFirst = "First"
$sLast = "Last"
$sUserID = "Test"
$NewUserOU = "whatever you want your OU to be"

$LDAP = GetObject("LDAP://" + @LDomain)
$LDAP_ADSPath = Substr($LDAP.ADSPath,Len(@LDomain) + 9,Len($LDAP.ADSPath) - Len(@LDomain))
$Cnt = 1
$FQDN1 = Split($LDAP_ADSPath,",")
For Each $Element in $FQDN1
$FQDN = $FQDN + Substr($Element,4,Len($Element) - 3) + "."
$Cnt = $Cnt + 1
Next
$FQDN = Substr($FQDN,1,Len($FQDN) - 1)
$FullName = "cn=" + $sLast + "\, " + $sFirst
$LDAP1 = GetObject("LDAP://" + $NewUserOU)
$NewUser = $LDAP1.Create("user",$FullName)
$NewUser.Put("samAccountName",$sUserID)
$NewUser.Put("sn",$sLast)
$NewUser.Put("givenName",$sFirst)
$PrincipalName = $sUserID + "@@" + $FQDN
$NewUser.Put("userPrincipalName",$PrincipalName)
$NewUser.Put("displayName",$sLast + ", " + $sFirst)
$ = $NewUser.SetInfo()
If @Error < 0
$NewUserError = Val("&" + Right(DecToHex(@Error),4))
EndIf
$ = MessageBox($NewUserError,"NewUser Error")



Thanks for your help!

Top
#133691 - 2005-02-12 12:55 AM Re: ADSI Error Codes
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Or maybe even the CError() UDF.
_________________________
There are two types of vessels, submarines and targets.

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 1363 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.032 seconds in which 0.016 seconds were spent on a total of 12 queries. Zlib compression enabled.

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