Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADSI LDAP user creation problems...

Status
Not open for further replies.

wraheem

MIS
Jul 19, 2001
62
US
OK, I have spent the last two days looking for a way to do this. I have written in VB.NET (a small script that will creat a new user in AD by binding to LDAP. Everything works until I get to the part where I try to set the primaryGroupID and the password. I get the error "The server is unwilling to process the request. (Exception from HRESULT: 0x80072035)"

I have been banging my head trying to get this to work using a million different ways using examples from VBScripting, Perl, VB6, everywhere and everything (except for C#, I don't know it)

I borrowed the the part about invoke(ing) the password from C#. (OK C# too)

I will be more than happy to be flamed with the answer because I have looked everywhere.

Code:
Dim OU As New DirectoryEntry("LDAP://server/ou=Group,DC=company, DC=COM")
        Dim User As DirectoryEntry = OU.Children.Add("CN=MMouse", "user")
        User.Properties("sAMAccountName").Value = "Mickey Mouse"
        User.Properties("Description").Value = "Test"
        'User.Properties("primaryGroupID").Value = 2098
        'User.Invoke("SetPassword", "password")
        'User.Password = "password"

        User.CommitChanges()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top