请教高手!!一段ADSI代码的问题!!!

lzh4481 2001-11-12 09:42:31
以下代码打**号的一句有问题。
错误类型:
服务器对象, ASP 0177 (0x800401F3)
无效的 ProgID。 该怎样解决呢????????????????
另:这段代码将**句改为:
Set rootDSE = GetObject("LDAP://rootDSE")后,在VB里完全正常!


<%
Dim strGroupCN 'As String
Dim grp 'As ActiveDs.IADsGroup
Dim mbr 'As ActiveDs.IADs
Dim rootDSE 'As ActiveDs.IADs
Dim ServerName 'As String
Dim DomainName 'As String


'Build the "LDAP" string to the group
strGroupCN = "cn=" & "shenhe"
** Set rootDSE = Server.CreateObject("LDAP://rootDSE")
DomainName = rootDSE.Get("defaultNamingContext")
ServerName = Mid(rootDSE.Get("dnshostname"), 1, InStr(rootDSE.Get("dnshostname"), ".") - 1)

'get the Group object
Set grp = CreateObject ("LDAP://" & ServerName & "/" & strGroupCN & ",ou=recipients," & DomainName)

%>
...全文
106 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
hyper2k 2001-11-18
  • 打赏
  • 举报
回复
我只会VBScript的代码:
set rootDSE = getobject("LDAP://rootDSE")
sDomain = rootDSE.get("defaultNamingContext")
set Domain = getobject("LDAP://" + sDomain)
sADsPath = Domain.ADsPath
set objs = getobject("LADP://OU=test, OU=ou1, " + sDomain
objs.Filter = array("group")
for each grp in objs
msgbox grp.name + vbCRLF + grp.ADsPath
next
phaqyxiao 2001-11-15
  • 打赏
  • 举报
回复
我知道你要干吗?抄下面这段吧!
Set oNet = CreateObject("wscript.network")
strcomputername = oNet.ComputerName
Set oDS = GetObject("LDAP://RootDSE")
Domain = oDS.Get("defaultNamingContext")
dnsname = oDS.Get("DnsHostName")
iLoc = InStr(1, dnsname, ".")
If iLoc <> 0 Then
newdnsname = Mid(dnsname, iLoc + 1, (Len(dnsname) - iLoc))
End If
strDomainName = newdnsname
lzh4481 2001-11-13
  • 打赏
  • 举报
回复
我的exchange, vb,所有的操作都在一台机子上!
lzh4481 2001-11-13
  • 打赏
  • 举报
回复
奇怪!!我在ASP页面里将**句改为GetObject后,也正常了!!

但在另一个地方有一句Set SysInfo = GetObject("ActiveDs.ADSystemInfo")在VB和ASP页面里都不可以!在VB里换成Set SysInfo = New ActiveDs.ADSystemInfo后正常了!在ASP里换成
Set SysInfo = Server.CreateObject("ActiveDs.ADSystemInfo")还是不行!

set ... = new ....
set ... = GetObject (...)
set ... = CreateObject (...)
set ... = server.createobject(...)
到底有些什么区别??????
LiXun 2001-11-13
  • 打赏
  • 举报
回复
Server.Createobject是在服务器端建立对象,你可能没有适当的权限,而在VB中用GetObect是调用本地的对象

535

社区成员

发帖
与我相关
我的任务
社区描述
企业开发 Exchange Server
社区管理员
  • 消息协作社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧