banner.gif (5982 bytes)

mslogo.gif (666 bytes)

router.gif (3874 bytes)

siteserver.gif (2941 bytes)
 

Requirements

  • Install Site Server 3.0 or Site Server Commerce Edition 3.0, and Site Server's Service Pack 2.  For more information about Site Server, click here.
  • Install ADSI 2.5, in this order.

 

Creating Members

This information is adopted from the Site Server Knowledge Base.

Dim oADsContainer
Dim oADsNewUser
Dim oGuidGen
Dim strGuid
Dim strLdapPath 'The path to the ou=Members container

strLdapPath = "LDAP://localhost:5292/o=Microsoft/ou=Members"

'Instantiate the GUID Generator that comes with Site Server
'and store the GUID for use later on.
Set oGuidGen = CreateObject("Membership.GuidGen.1")
strGuid = oGuidGen.GenerateGuid

'Bind to the container in which the Member will be created
Set oADsContainer = GetObject(strLdapPath)

'Create the new user object, note that the Create() method returns
'an interface pointer
Set oADsNewUser = oADsContainer.Create("member", "cn=JohnDoe")
oADsNewUser.Put "givenName", "John"
oADsNewUser.Put "sn", "Doe"
oADsNewUser.Put "userPassword", "password"
oADsNewUser.Put "GUID", CStr(strGuid)
oADsNewUser.SetInfo

'Destroy the objects
Set oGuidGen = Nothing
Set oADsNewUser = Nothing
Set oADsContainer = Nothing

 

Add Members to Groups

Adopted from the Site Server Knowledge Base.

Dim adsMemberOf
Dim adsGroup
Dim strLdapSrv
Dim strMemberPath, strUserCn, strUserDn, _
strGroupDn, strAdmin, strAdminPwd


strLdapSrv = "LDAP://localhost:5292"
strMemberPath = ",ou=Members,o=Microsoft"
strUserCn = "cn=JohnDoe"
strUserDn = strUserCn + strMemberPath
strGroupDn = strLdapSrv + "/o=Microsoft/ou=Groups/cn=Public"
strAdmin = "cn=Administrator,ou=Members,o=Microsoft"
strAdminPwd = "password"



'Bind to the specific group using Administrator credentials
Set adsGroup = GetObject("LDAP:")
Set adsGroup = adsGroup.OpenDSObject(strGroupDn, strAdmin, _
strAdminPwd, CLng(0))



'Create the new 'memberOf' object that will be stored in the group
Set adsMemberOf = adsGroup.Create("memberof", strUserCn)

'Add the path to the user and store it in the 'memberObject' property
adsMemberOf.Put "memberobject", CStr(strUserDn)

'Flush the property cache and update the directory
adsMemberOf.SetInfo

'Destroy the objects Set adsMemberOf = Nothing
Set adsGroup = Nothing