Solved

When using ADSI to create user, error returned as "80072035 The server is unwilling to process the request".

Posted on 2004-10-06
3
3,061 Views
Last Modified: 2008-01-09
Hi all, I use the ADSI in VB6.0 to create user as following:

Dim sPrefix, sContainerDN, sadminname, sadminpwd
Dim sUser
sPrefix="LDAP://temp.company.net/"
sContainerDN="OU=Person,OU=companySSO,DC=company,DC=net"
sadminname="COMPANYNET\administrator"
sadminpwd="password"

Dim oNameSpace, oOUCont
Set oNameSpace = GetObject("LDAP:")
Set oOUCont = oNameSpace.OpenDSObject(sPrefix & sContainerDN, sadminname, sadminpwd, 0)
Set User = oOUCont.Create("user", "cn=test0001")
User.Put "samAccountName", "test0001"
User.SetInfo     ' <- error occur here

If Err.Number <> 0 Then
  MsgBox Err.Number & ": " & Err.Description & " - " & Err.Source
else
  Msgbox "Success"
End If

The returned error occurred at User.SetInfo and the error is: "80072035 The server is unwilling to process the request".
Could anyone give me some hints?

Thanks a lot.
0
Comment
Question by:heikan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 56

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 12236479
I modified your script slightly as shown below. By specifying the CN=Users in the DNName field it worked successfully. I am not sure about how your environment is setup but try modifying your script accordingly.


Dim sPrefix, sContainerDN, sadminname, sadminpwd
Dim sUser
sPrefix="LDAP://marcorp/" <--- I did not use this but you can modify based on change below
sContainerDN="OU=Person,OU=companySSO,DC=company,DC=net" <--- I did not use this but you can modify based on change below
sadminname="Marcorp\administrator"
sadminpwd="tqbfjotld"

Dim oNameSpace, oOUCont
Set oNameSpace = GetObject("LDAP:")
Set oOUCont = oNameSpace.OpenDSObject("LDAP://cn=users,DC=mydomain,DC=local", sadminname, sadminpwd, 0)   <---- changed the object definition
Set User = oOUCont.Create("user", "cn=test0001")
User.Put "samAccountName", "test0001"
User.SetInfo     ' <- error occur here

If Err.Number <> 0 Then
  MsgBox Err.Number & ": " & Err.Description & " - " & Err.Source
else
  Msgbox "Success"
End If
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about a problem I had getting the GPS LocationListener working.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question