Got this code to create user & add it to group. In the last part of
adding the user to a group I have a syntax problem. I want each
UserNo i created in the loop be added to a security group. cannot seem
to find the rihgt syntax.
please help.

TIA,

Ronen


Const ADS_PROPERTY_APPEND = 3
Set objRootDSE = GetObject("LDAP://rootDSE")
Set objContainer = GetObject("LDAP://OU=test,OU=Misc,OU=TAU," & _
objRootDSE.Get("defaultNamingContext"))
Set objGroup = GetObject _
("LDAP://CN=cn=Terminal Server User,OU=test,OU=Misc,OU=TAU")



For i = 1 To 5
Set objLeaf = objContainer.Create("User", "cn=UserNo" & i)
objLeaf.Put "sAMAccountName", "UserNo" & i
objLeaf.Put "userPrincipalName", "UserNo" & i
objLeaf.Put "givenName", "UserNo" & i
objLeaf.Put "displayName", "UserNo" & i
objLeaf.SetInfo

objLeaf.SetPassword "111111"
objLeaf.AccountDisabled = False
objLeaf.SetInfo

objGroup.PutEx ADS_PROPERTY_APPEND, _
"member", Array("cn=UserNo" & i "objContainer" )
objGroup.SetInfo


Next

WScript.Echo "5 Users created."