.putEx won't add record to attribute

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 16 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
roetherb
Posts: 7
Last visit: Tue Jun 19, 2007 2:55 am

.putEx won't add record to attribute

Post by roetherb »

language: vbscript
DS: eDirectory

I am trying to append a new object class to .objectClass using the following code:
objUser.putEx 3, "objectClass", Array("newObjectClass")objUser.setInfo
The script errors out on the .setInfo line, with the message "The requested operation did not satisfy one or more constraints associated with the class of the object."
However, the following code works flawlessly.
For each item in objUser.objectClass WScript.echo itemNext
...which returns the proper list of object classes, indicating that .objectClass is, in fact, read as a collection.
I am told there may be a different procedure in adding an auxillary class than the procedure to simply add a record to a collection in ADSI...

I am using the exact same block of code to add records to many other collections in the directory with no problems. What is different about eDirectory's .objectClass attribute that is causing this problem?
Thanks!
-Bradroetherb2007-06-18 12:17:17
User avatar
jhicks
Posts: 1789
Last visit: Mon Oct 19, 2015 9:21 am

.putEx won't add record to attribute

Post by jhicks »

I would expect the For Each statement to work because you are enumerating the existing object class. You appear to be doing something else. Are you trying to extend the schema for the user class? If so, I think that is a very different process.
User avatar
roetherb
Posts: 7
Last visit: Tue Jun 19, 2007 2:55 am

.putEx won't add record to attribute

Post by roetherb »

No, I'm just trying to add the posixAccount and uamPosixUser object classes to one particular user.

I looked up the RFC definition of posixAccount, which requires that...

objUser.cn
objUser.uid
objUser.uidNumber
objUser.gidNumber
objUser.homeDirectory

...all be defined.

I then created the following code to test.

With objUser
.put "cn","USER1234"
.put "uid","USER1234"
.put "uidNumber","9999"
.put "gidNumber","9999"
.put "homeDirectory","/home/testuser"

.putEx 3,"objectClass",Array("posixAccount")

.setInfo
end With

...which produced the same error as before.

Any thoughts?

Thanks!

-Brad
roetherb2007-06-18 14:25:58
User avatar
roetherb
Posts: 7
Last visit: Tue Jun 19, 2007 2:55 am

.putEx won't add record to attribute

Post by roetherb »

The object classes posixAccount and uamPosixUser already exist, I'm just making a single user a member of each of those object classes. I'm not trying to change the object class itself...This all makes me a little more worried that I won't be able to do what I want to do here haha...The purpose of the script is to automate the creation of LUM accounts through an enterprise security utility. All I need to do is check to see if the user is already a member of posixAccount and uamPosixUser, and if not, add them to the user's objectClass list. Then I need to check the user's home directory, gid, etc etc etc, and write it all back to novell's eDirectory.It would be fairly useless for me to post the script in its current form, as it would take hours for me to edit out all my company info and whatnot, plus it's so muddled with echos, you can barely follow the flow anyway. It's code only a father could love. ;)-Brad
User avatar
roetherb
Posts: 7
Last visit: Tue Jun 19, 2007 2:55 am

.putEx won't add record to attribute

Post by roetherb »


DS: eDirectory
Then I need to check the user's home directory, gid, etc etc etc, and write it all back to novell's eDirectory.This is Novell's eDirectory sitting on a windows machine.roetherb2007-06-19 06:50:05
User avatar
roetherb
Posts: 7
Last visit: Tue Jun 19, 2007 2:55 am

.putEx won't add record to attribute

Post by roetherb »

Found my answer, sort of...Can anyone translate this line of VB code into vbscript:Dim straObjClass() As Object ={"inetOrgPerson", "posixAccount", "shadowAccount"}I have looked high and low, and can't see how to define your own object in vbscript without using CreateObject, which I don't think will work in this case.Thanks,-Brad
User avatar
roetherb
Posts: 7
Last visit: Tue Jun 19, 2007 2:55 am

.putEx won't add record to attribute

Post by roetherb »

The classes already exist... I am trying to add the already existing class to the user's objectclass list.Hmmm an instance of a class... How can I grab an instance of a class and add it to my user's list of objectclasses?Thanks,-Brad
User avatar
roetherb
Posts: 7
Last visit: Tue Jun 19, 2007 2:55 am

.putEx won't add record to attribute

Post by roetherb »

Let's see... I'm a bit new at this myself, so I'll do my best to explain.right now, the following code.... strUserName="cn=SOMEADMIN,ou=Admin,ou=Services,o=Foobar" strPassword="SOMEPASSWORD" strPath = "LDAP://ldapserver.foo.bar/cn=SOMEUSER,ou=people,o=Foobar" Set adsNameSpace = GetObject("LDAP:") Set adsUser = adsNameSpace.OpenDSObject(strPath, strUserName, strPassword, 0) for each item in adsUser.objectClass WScript.echo item Next...returns the following: inetOrgPerson organizationalPerson Person ndsLoginProperties Top...I need it to return this instead: inetOrgPerson organizationalPerson Person ndsLoginProperties Top posixAccount uamPosixUser...so that this user will inherit all the attributes associated with being classified under the two posix object classes. There are hundreds of other users already assigned the two posix object classes with no problems, so these classes are defined and already exist within eDirectory.Thanks!
roetherb2007-06-19 10:01:20
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

.putEx won't add record to attribute

Post by jvierra »

jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

.putEx won't add record to attribute

Post by jvierra »

roetherb


In VBScript you use:

Set oMyObj = CreateObject("ProgID.Class")

If you are not versed in scripting I suggest you use the utilities that come with Novell NDS for doing this.

There are command line utilities on the Novell server that run on NT. These will allow you to create users, adjust membership and such.

If you really need to script this then you need to go to a Novell forum. There is not one here who is up to date on NDS and NDAP. This is a custom flavor of LDAP. Tryng ot help you any further would probably just wste your time. I haven't worked with NDS for a number of years an have never really used NDS over LDAP.

If you have specific questions about vbscript syntax, formats, erros then post here and someeone will be able to help you.

Just don't want to waste your time.

Good luck.
This topic is 16 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked