当前位置:才华咖 > 互联网计算机 > 设计制作 > 网页设计 > vbscript自动配置IIS代码
手机版

vbscript自动配置IIS代码

来源:才华咖 阅读:6.11K 次

复制代码 代码如下:

vbscript自动配置IIS代码

strServerName=""localhost""

strRootPath=""g:documents""'虚拟目录路径

strVRName=""Test""'虚拟目录名称

strDefaultDoc=""""'起始文档

DimobjIIS

'MsgBox""IIS://""&strServerName&""/W3SVC/1""

OnErrorResumeNext

SetobjIIS=GetObject(""IIS://""&strServerName&""/W3SVC/1"")

Iferr=-2147024893Then

MsgBox""IIS不存在!""&vbcrlf&""请验证IIS是否已正确安装!"",vbcritical

ElseIferr<>0Then

MsgBox""未知错误!"",vbcritical

EndIf

OnErrorGoTo0

SetobjVirtualDir=bject(""IISWebVirtualDir"",""Root"")

ForeachVRinobjVirtualDir

=strVRNameThen

MsgBox""虚拟目录""&strVRName&""已存在!"",vbinformation

EndIf

Next

OnErrorResumeNext

Setfs=teObject(""SystemObject"")

SetobjFolder=older(strRootPath)

Iferr=76Then

MsgBox""路径""&strRootPath&""不存在!"",vbcritical

EndIf

SetobjFolder=nothing

Setfs=nothing

OnErrorGoTo0

OnErrorResumeNext

SetVirDir=te(""IISWebVirtualDir"",strVRName)

ssRead=true

=strRootPath

ultDoc=ultDoc&"",""&strDefaultDoc

nfo

Iferr<>0Then

MsgBox""创建虚拟目录失败!"",vbcritical

Else

MsgBox""虚拟目录""&strVRName&""成功创建在服务器""&strServerName&""上!"",vbinformation

EndIf

代码的关键在于创建虚拟目录,及其中的配置:

SetVirDir=te(""IISWebVirtualDir"",strVRName)

ssRead=true

=strRootPath

ultDoc=ultDoc&"",""&strDefaultDoc

nfo

本文链接:https://www.caihuaka.com/sjzz/sjzz/xj9wnv.html

Copyright © 2024. 才华咖 All right reserved. 浙ICP备20120231号-3

文字美图素材,版权属于原作者。部分文章内容由网友提供推送时因种种原因未能与原作者联系上,若涉及版权问题,敬请原作者联系我们,立即处理。