ObjectClass Attribute not Defined RRS feed

  • Question

  • I am trying to set up a .csv file to create users on my windows 2016 server. I setup this script which should work but in not.

    "CN=CSV User1,OU=TestOU1,DC=USAGOV,DC=GOV",CSVUser1, CSVUser1@USAGOV.gov,user
    "CN=CSV User2,OU=TestOU1,DC=USAGOV,DC=GOV",CSVUser2, CSVUser2@USAGOV.gov,user

    The message says objectClass Attribute not defined

    Tuesday, March 24, 2020 3:47 PM

All replies

  • What message says that?   We know of no messages that say that.  

    Without clear, accurate information, a script and the complete error message, it will not be possible to help you.


    Tuesday, March 24, 2020 3:56 PM
  • When creating a user in AD, you do not specify the distinguished name. Instead, you specify the DN of the parent container/OU and the RDN (the value of the cn attribute). You assign the sAMAccountName and specify the class of object as "user".

    Are you using the New-ADUser PowerShell cmdlet. If so, there is no need to assign the class. It is implied. If you are using System.DirectoryServices.DirectoryEntry, you use the Create method of the Parent OU/container object and specify the class (user) and the value of the cn attribute, then assign sAMAccountName. No method I am aware of refers to the objectClass attribute directly.

    Edit: Also, the objectClass attribute is multi-valued. If somehow you had code that assigns the objectClass attribute, you would need to assign all 4 values appropriate for users, or the new object would not be a valid user: organizationalPerson, person, top, and user.

    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    Tuesday, March 24, 2020 4:37 PM