Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


ADSI - Creating Computer Accounts

Keywords: 	 ADSI - Creating Computer Accounts

Question:

I want to be able to create workstation accounts on Active Directory through a script, however I am having a problem with a constraint violation error. I have confirmed that the ldap path is valid, that there are no outstanding rights that are lacking, and that the script's syntax is (so far as I can tell) accurate.

Can anyone let me know what the constraint violation might be?

AddExtender("WWADS34I.DLL")
username = askline("Active Directory - Create Workstation","Your Name:","")
userpassword = askpassword("Active Directory - Create Workstation","Your password:")
dsSetCredent("%username%","%userpassword%")
sASDIPath = "LDAP:COMPLETE LDAP PATH GOES HERE"
sObjectClass = "Computer"
sObjectName = askline ("Active Directory - Create Workstation","Workstation name:","")
sObjectPath = dsCreateObj("%sASDIPath%","%sObjectClass%","CN=%sObjectName%")
dsSetObj("%sObjectPath%")

message ("Active Directory - Create Workstation","All done!")

exit

Answer:

You have to set the sAMAccountName property to StrUpper(StrCat(Computername,"$"))