Add server operator, from Zdtips, in 中文版

Source: Internet
Author: User
Tags ftp iis nntp
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 is translated to
ASP) shows an sample way of the 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 ' 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 = &AMP;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
Bits running this script without specifying a 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.