Login | |
|
 |
Create user, copy a users memberships - 11/5/2007 11:45:04 PM
|
|
 |
|
| |
deen
Posts: 3
Score: 0
Joined: 11/5/2007
Status: offline
|
Please please help im trying to find and copy a user's memberships, (similar user "strmember") i have cut the relevant text from my script , this is not the complete script. the full script creates a new user. in addition i would like to input a text box (textbox8)for similar user(strmember) to copy memberof to to the new user created in the script(strUser) ====================================================================================================================== strUser = TextBox0.Value If strUser = "" Then MsgBox "You're missing required fields.",64, "Alert" Exit Sub End If strmember = TextBox8.Value =================================================================================================================== On Error Resume Next Const E_ADS_PROPERTY_NOT_FOUND = &h8000500D Const ADS_PROPERTY_APPEND = 3 Set objUser = GetObject("LDAP://"CN=" & strmember &",OU=Accounts,OU=test,dc=test,dc=com") arrMemberOf = objUser.GetEx("memberOf") If Err.Number = E_ADS_PROPERTY_NOT_FOUND Then WScript.Echo "The memberOf attribute is not set." Else For each Group in arrMemberOf ' WScript.Echo Group Set objGroup = GetObject("LDAP://" & Group) objGroup.PutEx ADS_PROPERTY_APPEND, "member", Array("CN=" & strUser & ",ou=test,dc=test,dc=com") objGroup.SetInfo Next End If =============================================================================================================== <tr> <td width="89"><span class="style5">*</span>Login ID: </td> <td width="144"><input type="text" name="textbox0"></td> </tr> <tr> <td>Similar User: </td> <td><input type="text" name="textbox8"></td> </tr>
|
|
| |
|
|
|
 |
RE: Create user, copy a users memberships - 11/7/2007 12:45:49 PM
|
|
 |
|
| |
deen
Posts: 3
Score: 0
Joined: 11/5/2007
Status: offline
|
getting close to solution, what do you experts think????????????????????????????? =============================================================================== On Error Resume Next Const E_ADS_PROPERTY_NOT_FOUND = &h8000500D Const ADS_PROPERTY_APPEND = 3 Set objUser = GetObject("LDAP://"& strmember & ",OU=Accounts,OU=test,dc=test,dc=com") arrMemberOf = objUser.GetEx("memberOf") If Err.Number = E_ADS_PROPERTY_NOT_FOUND Then MsgBox ""The memberOf attribute is not set.",64, "Alert" Else For each Group in arrMemberOf ' MsgBox ""Group",64, "Alert" Set objGroup = GetObject("LDAP://"& strmember & ",OU=Accounts,OU=test,dc=test,dc=com") objGroup.PutEx ADS_PROPERTY_APPEND,_ "member", Array("CN=" & strUser & ",ou=test,dc=test,dc=com") objGroup.SetInfo Next End If ============================================================= ideally i would also like to move the new user to the same OU as the similar user.
|
|
| |
|
|
|
| |
|
|
 |
|
 |
|
|