时间: 2021-07-31 作者:daque
adding server operatorsoccasionally, you might want to add server operators for the ftp- orwww-server with adsi. the vbscript below (which can also be translated toasp) 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 explicitdim iisdim acldim sddim acedim accdim argdim netset arg = wscript.argumentsif arg.count < 1 thenwscript.echo "usage: addadmin <ftp | w3 | nntp | smtp><user>"wscript.quitend ifset 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 elsewscript.echo "usage: addadmin <ftp | w3 | nntp | smtp><user>"wscript.quitend selectset sd= iis.adminaclset acl = sd.discretionaryaclif arg.count = 2 thenset ace = createobject("accesscontrolentry")ace.trustee = arg(1)ace.accessmask = &hbi did not find the real permissions (actrl_??? bits) description foraccessmask, but i've copied it from a manual added entry. you can see thebits running this script without specifying an useracl.addace aceiis.adminacl = sdiis.setinfoelsefor each ace in aclwscript.echo ace.trustee & " (0x" &hex(ace.accessmask) & ")"nextend if