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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADSI Error

Status
Not open for further replies.

FRANDAZZO

Programmer
Nov 29, 2000
60
US
Hello , Question - why am I getting this following error when going to add a First or Last name to a windows domain user account using ADSI. Error - "The attempted action violates the DS schema rules." Now using the same function I am able to create a new account, add a description, the full name, password with no problems. It's just when adding the First or Last name for the user account.

Here is the code:
Set objComputer = GetObject("WinNT://" & strDomain)

'Create the New User Login name.
Set objNewUser = objComputer.Create("User", strLogin)
objNewUser.SetInfo

'Set the Users Password.
objNewUser.SetPassword (strPwd)

'This causes the error:
objNewUser.FirstName = strFname

'This causes the error:
objNewUser.LastName = strLname

'Set the users Full Name
objNewUser.FullName = strFname & " " & strLname

'Set the users NT Description
objNewUser.Description = strUserNTDescription

'Add all the users into to NT
objNewUser.SetInfo

Thanks,
Frandazzo
 


frandazzo,

Do you actually have a FirstName and LastName field in your ADSI directory to store these variables?

fengshui1998
 
I am not sure what you mean. But if you are asking if the First and Last name text boxes appear when you right click on a user name in active directory and select properties then yes they are there. Just like the Full name and Description text boxes are there. And like I said the Description and Full Name text boxes will get populated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top