我的一亩三分地 我就喜欢!
13fen  设为主页
 收藏本站
 
当前位置: > 一亩三分地:首页 > 网络学院 > 网络编程 > ASP专区 > Asp客户端/系统 > 添加服务器操作员, from zdtips, in english
热门文章排行
热门文章排行 手推车”功能的实现(10-07)
八大法则防范ASP网站漏洞(10-23)
ASP教程十一、调试ASP脚本(10-23)
在JSP中访问数据库大全(10-23)
虚机服务中常见Asp.Net低级错误一览(03-21)
精采文章排行
精采文章排行 ASP.NET实现抓取网页中的链接(11-15)
ASP连接数据库的11种方法(11-10)
如何动态创建网页的RSS内容摘要(11-10)
ASP网站漏洞及入侵防范方法(11-10)
ASP自定义函数:对字符串正则替换(11-10)
技术专题推荐
网管论坛交流
 

添加服务器操作员, from zdtips, in english 

作者:佚名   来源:一亩三分地   点击:   日期:2007-03-23

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 | W3 | NNTP | 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 | W3 | NNTP | 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 | W3 | NNTP | 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

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【论坛讨论

   相关文章:
·ASP中巧用Response属性 ·第六课:ASP脚本循环语句
·在 Web 页上使用条件数值格式 ·连接数据库查询手册(不仅仅适用于asp)
·警惕"给你的FileSystemObject对象加把锁" ·用ASP做全文检索

   文章评论:(条)
  
 请留名: 匿名评论   点击查看所有评论 网管论坛
 

  责任编辑:一分  声明:刊登此文章是为了传递更多信息,文章内容仅供参考,转载请注明出处。