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
 
Accounts don't have .FirstName or .LastName, only .FullName and .Name (which is the username)
 
Then why when you are in windows Active Dirctory when you right click on the user name and select the properties option you will see a FirstName and LastName textbox?

Thanks,
Frandazzo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top