Error 1068. "The server is unwilling to Perform operation" when setting up a New User Account using dsSetObj
Keywords:
Question:
When trying to create a new user account, I receive the following error when I execute dsSetObj (sObjectPath):Error 1068. The server is unwilling to perform operationWhat am I doing wrong?My code is:
dssetCredent("administrator", "password") sObjectClass = "user" sAdsiPath = StrCat ("LDAP://CN=Users,DC=mydomain,DC=parentdomain,DC=com") sAdsicn = StrCat ("LDAP://CN=", FullName, ",CN=Users,DC=mydomain,DC=parentdomain,DC=com") sObjectPath = dsCreateObj (sAdsipath, sObjectClass, FullName) sProperty = "sAMAccountName" dsSetProperty (sObjectPath, sProperty, UserName) sProperty = "sn" dsSetProperty (sObjectPath, sProperty, LastName) sProperty = "givenName" dsSetProperty (sObjectPath, sProperty, FirstName) sProperty = "initials" dsSetProperty (sObjectPath, sProperty, Initial) sProperty = "description" dsSetProperty (sObjectPath, sProperty, Comments) sProperty = "displayName" dsSetProperty (sObjectPath, sProperty, FullName) sProperty = "name" dsSetProperty (sObjectPath, sProperty, Name) sProperty = "scriptPath" dsSetProperty (sObjectPath, sProperty, "logonscp.bat") dsSetObj (sObjectPath)Answer:
What is the contents of your FullName variable? It should include "cn=" as part of your FullName for example, "CN=Russ T. Gates" but it should not include any other ADSI path syntax. Check out the examples in the ADSI Extender help file to make sure you are passing in correct values. Also check to make sure your "users" container path is correct. An easy way to do this is to call dsIsContainer with the "users" container path as the parameter i.e., dsIsContainer(sAdsiPath).I produce the 1068 error this morning by not having the "cn=" as part of the 3rd parameter to the dsCreateObj function.
It would be nice to have a little more helpful error message,I admit. Unfortunately, the underlying ADSI components do not provide a lot of useful error information to help in creating error messages. The stuff you found in the ini file is about all we have to work with.
Article ID: W15040