asp中 添加服务器操作员

蝈蝈俊 2000-07-06 01:49:00
添加服务器操作员


Adding Server Operators

Occasionally, you might want to add server operators for the FTP- or
WWW-server with ADSI. The VBScript below (which can also be translated to
ASP) shows an sample way of accomplishing this task.

'
' AddAdmin.vbs - Add an administrator to FTP, W3, NNTP or SMTP Service
'
' Usage: addadmin <FTP and W3 and NNTP and SMTP> <User>
'
' Without changes the script must run on the local webserver.
' User in the form <domain>\<user>
'

Option Explicit

Dim iis
Dim acl
Dim sd
Dim ace
Dim acc
Dim arg
Dim net


Set arg = Wscript.Arguments
If arg.count < 1 Then
Wscript.Echo "Usage: addadmin <FTP and W3 and NNTP and SMTP>
<User>"
Wscript.Quit
End If

Set net = CreateObject("Wscript.Network")

Select Case Ucase(arg(0))
Case "FTP" Set iis = GetObject("IIS://" & net.computerName
& "/MSFTPSVC/1")
Case "W3" Set iis = GetObject("IIS://" & net.computerName
& "/W3SVC/1")
Case "NNTP" Set iis = GetObject("IIS://" & net.computerName
& "/NNTPSVC/1")
Case "SMTP" Set iis = GetObject("IIS://" & net.computerName
& "/SmtpSvc/1")
Case Else
Wscript.Echo "Usage: addadmin <FTP and W3 and NNTP and SMTP>
<User>"
Wscript.Quit
End Select

Set sd = iis.AdminACL
Set acl = sd.DiscretionaryAcl

If arg.Count = 2 Then
Set ace = CreateObject("AccessControlEntry")
ace.Trustee = arg(1)
ace.AccessMask = &HB

I did not find the real permissions (ACTRL_??? bits) description for
AccessMask, but I've copied it from a manual added entry. You can see the
bits running this script without specifying an user

acl.AddAce ace
iis.AdminAcl = sd
iis.SetInfo
Else
For Each ace In acl
Wscript.Echo ace.Trustee & " (0x" &
Hex(ace.AccessMask) & ")"
Next
End If

不只好不好用,目前又没法用.好用的话请发贴提示.
...全文
55 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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