麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 網站 > IIS > 正文

用VBS創建IIS虛擬站點實例

2024-08-29 03:13:53
字體:
來源:轉載
供稿:網友

' ---------------------------------------------------------------------------
' creates or deletes the virtual directory http://localhost/channel7
'
' valid command line switches: -i -u -q
'   -i  install virtual directory
'   -u  remove virtual directory
'   -q  run in quiet mode
'
' ---------------------------------------------------------------------------
' see http://www.microsoft.com/windows2000/en/advanced/iis/default.asp?url=/windows2000/en/advanced/iis/htm/asp/aore8v5e.htm

option explicit

dim vpath,vname, vwshshell, vobjargs, vinstall, vremove, vquiet, i

vname = "channel7"

' get current path to folder
vpath = left(wscript.scriptfullname, instrrev(wscript.scriptfullname, "/", 15) - 1)
vpath = vpath & "/owbase"

'set wshshell = wscript.createobject("wscript.shell")
'vpath = wshshell.regread("hklm/software/channel7") & "/owbase"

vquiet = false
vinstall = false
vremove = false

set vobjargs = wscript.arguments

for i = 0 to vobjargs.count - 1
    if instr(lcase(vobjargs(i)), "i") <> 0 then
        vinstall = true
    elseif instr(lcase(vobjargs(i)), "u") <> 0 then
        vremove = true
    end if
    if instr(lcase(vobjargs(i)), "q") <> 0 then
        vquiet = true
    end if
next

if vremove then
    deletevdir vname
elseif vinstall then
    createvdir vname, vpath
end if


sub createvdir(pname, ppath)
    dim vroot, vbasedir, vwebsite, ipsecurityobj, iplist

    on error resume next

    ' get the local host default web
    set vwebsite = getobject("iis://localhost/w3svc/1")
    if not isobject(vwebsite) then
        display "unable to locate the default web site. iis must be installed and running."
        exit sub
    else
        'display vwebsite.name
    end if

    ' get the root
    set vroot = vwebsite.getobject("iiswebvirtualdir", "root")
    if (err <> 0) then
        display "unable to access root for " & vwebsite.adspath
        exit sub
    else
        'display vroot.name
    end if

    ' find or create the ow vroot.
    ' the physical path to http://localhost/ow is set to the ...<install-dir>/owbase folder
    err.number = 0 'clear error
    set vbasedir = getobject(vroot.adspath & "/" + pname)
    if err.number <> 0 then
        err.number = 0
        set vbasedir = vroot.create("iiswebvirtualdir", pname)
        vbasedir.accessread = true
        vbasedir.accessflags = 513  ' = 0x200 + 0x01 = md_access_script + md_access_read
        vbasedir.appcreate false
        vbasedir.aspallowsessionstate = false
        vbasedir.setinfo ' this section restricts access to everyone except localhost (127.0.0.1).
        'set ipsecurityobj = vbasedir.ipsecurity
        'ipsecurityobj.grantbydefault = false
        'iplist = ipsecurityobj.ipgrant
        'redim iplist(ubound(iplist) + 1)
        'iplist(ubound(iplist)) = "127.0.0.1"
        'ipsecurityobj.ipgrant = iplist
        'vbasedir.ipsecurity = ipsecurityobj
        'vbasedir.setinfo

        vbasedir.path = ppath
        vbasedir.appfriendlyname = "channel7"
        vbasedir.setinfo

        if (err <> 0) then
            display "un

|||,歡迎訪問網頁設計愛好者web開發。able to create " & vroot.adspath & "/" & pname
            exit sub
        else
            err = 0
            'display vbasedir.name
        end if
    end if

end sub


sub deletevdir(pname)
    dim vroot, vbasedir, vwebsite, ipsecurityobj, iplist
    on error resume next

    ' get the local host default web
    set vwebsite = getobject("iis://localhost/w3svc/1")
    if not isobject(vwebsite) then
        display "unable to locate the default web site. iis must be installed and running."
        exit sub
    else
        'display vwebsite.name
    end if

    ' get the root
    set vroot = vwebsite.getobject("iiswebvirtualdir", "root")
    if (err <> 0) then
        display "unable to access root for " & vwebsite.adspath
        exit sub
    else
        'display vroot.name
    end if

    err.number = 0 'clear error
    set vbasedir = getobject(vroot.adspath)

    vbasedir.delete "iiswebvirtualdir", pname
    vbasedir.setinfo

    if not vquiet then
        wscript.echo "virtual directory http://localhost/" & vbasedir.name & "/" & pname & " deleted successfully."
    end if
end sub


sub display(pmsg)
    if not vquiet then
        wscript.echo now & ". error code: " & hex(err) & " - " & pmsg
    end if
end sub

 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 久国产 | 久久久经典视频 | 鲁久久| 国产一级毛片国产 | 欧美一级黄色免费 | 亚洲成在人 | 一级片999| 九九热免费视频在线观看 | 性欧美极品xxxx欧美一区二区 | 视频一区二区久久 | 久久精品一区二区三区四区五区 | 欧美a视频| 嫩呦国产一区二区三区av | 高清国产在线 | 黑人一区二区三区四区五区 | 最新欧美精品一区二区三区 | 久久55| 国产精品成人一区二区三区电影毛片 | 91网站在线观看视频 | 91成人一区| 成人三级免费电影 | 国产视频精品在线 | 久久99亚洲精品 | 日韩黄网站 | 成人免费观看av | 一级黄色在线观看 | 久久精品亚洲精品国产欧美kt∨ | 欧美3p激情一区二区三区猛视频 | 高清国产午夜精品久久久久久 | h网站在线观看 | 成人片免费视频 | wwwav国产 | 91九色电影 | 舌头伸进添的我好爽高潮网站 | 国产午夜电影 | 久久久三区 | 午夜精品毛片 | 精品亚洲一 | 曰批全过程120分钟免费69 | 黄色毛片视频在线观看 | 91短视频网址 |