动网论坛,站长建站首选,国内使用量最多的论坛软件 动网论坛官方技术讨论区 站长工具 申请属于您自己的免费论坛
首页 | 新闻资讯 | 网站运营 | 网络编程 | 数据库 | 服务器 | 网页设计 | 图像媒体 | 网络应用 | 搜索优化 | 资源下载 | 动网主机 | DVBOX
    本站内  互联网 ASP论坛  ASP.Net论坛  PHP论坛
   .Net → 阅读文章

 如何通过编程为组添加成员

作者来源: 
阅读 数 628 人次 , 2006-4-26 9:49:00 


概要
本文讨论如何使用 Active Directory Service Interfaces (ADSI) 2.0 和 VBScript 通过编程将成员添加至 Site Server 3.0 Membership Directory 的某个特定组中。


更多信息
按照下列步骤将某个成员添加至 Site Server 3.0 的一个组中:


绑定要添加用户的组。


根据要添加至组(成员必须存在)的用户的公用名称 (CN) 创建新 MemberOf 对象。


将 MemberObject 属性设置为要添加用户的辨别名称 (DN)。


下列代码演示了该过程:
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

参考
Active Directory Service Interfaces version 2.0 位于 Microsoft Developer Network Library/SDK Documentation/Platform SDK/Networking and Distributed Services 上。

关键字:prodsitesrv3
问题类型:
问题类型技术:

  
 
 收藏本文  打印本文  论坛讨论  关闭窗口
· 上一篇:通过 ASP 记录进行分页
· 下一篇:用ASP代码创建EXCHANGE2000用户
· 通过事例学习.net的WebForms技术(四)
· Windows.NET Server: IIS 6.0
· 也说C#实现对Word文件读写
· asp.net高级教程(三)-对象
· .NET 中的对象序列化


关于本站 | 联系我们 | 业务合作 | 客户案例 | 诚聘英才 | 广告合作 | 收藏本站
海口动网先锋网络科技有限公司版权所有
Copyright © 2000 - 2006 Cndw.Com
中华人民共和国电信与信息服务业务经营许可证编号 琼 ICP 020077