Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to set the memberof in the ad.

Status
Not open for further replies.

hartlen

IS-IT--Management
Aug 31, 2004
24
CN
i want to add a user to a group, when i get the user ,can i use the "memberof" to add it to the group ,which it belong to , can i use the putex method .when i try ,warning me it dont like to deal with it .i dont know how to do ,whether it can do

thanks
 
Hello hartlen,

If you use WinNT: provider, it can be done like this.
[tt]
sdom="a0b1c2"
sgroup="dev"
suser="jsmith"

set ogroup=getobject("WinNT://" & sdom & "/" & sgroup & ",group")
set ouser=getobject("WinNT://" & sdom & "/" & suser & ",user")
ogroup.add ouser.AdsPath
[/tt]
regards - tsuji
 
Pretty easy using LDAP also

Code:
	Set newMember = GetObject("LDAP://cn=" & DinstinguishedName & ",cn=Users,dc=your_domain_here,dc=com")

	Set newGroup = GetObject("LDAP://cn=" & Projectnumber & ",cn=Users,dc=your_domain_here,dc=com")

	newGroup.Put ADS_PROPERTY_APPEND, "Member", newMember
	newGroup.SetInfo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top