亚洲精品中文字幕无乱码_久久亚洲精品无码AV大片_最新国产免费Av网址_国产精品3级片

VBScript

vbscript自動配置IIS代碼

時間:2024-06-27 08:04:25 VBScript 我要投稿
  • 相關(guān)推薦

vbscript自動配置IIS代碼

  復(fù)制代碼 代碼如下:

  strServerName=""localhost""

  strRootPath=""g:documents""'虛擬目錄路徑

  strVRName=""Test""'虛擬目錄名稱

  strDefaultDoc=""index.asp""'起始文檔

  DimobjIIS

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

  OnErrorResumeNext

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

  Iferr=-2147024893Then

  MsgBox""IIS不存在!""&vbcrlf&""請驗證IIS是否已正確安裝!"",vbcritical

  Wscript.Quit

  ElseIferr<>0Then

  MsgBox""未知錯誤!"",vbcritical

  Wscript.Quit

  EndIf

  OnErrorGoTo0

  SetobjVirtualDir=objIIS.GetObject(""IISWebVirtualDir"",""Root"")

  ForeachVRinobjVirtualDir

  IfVR.Name=strVRNameThen

  MsgBox""虛擬目錄""&strVRName&""已存在!"",vbinformation

  Wscript.Quit

  EndIf

  Next

  OnErrorResumeNext

  Setfs=Wscript.CreateObject(""Scripting.FileSystemObject"")

  SetobjFolder=fs.GetFolder(strRootPath)

  Iferr=76Then

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

  Wscript.Quit

  EndIf

  SetobjFolder=nothing

  Setfs=nothing

  OnErrorGoTo0

  OnErrorResumeNext

  SetVirDir=objVirtualDir.Create(""IISWebVirtualDir"",strVRName)

  VirDir.AccessRead=true

  VirDir.Path=strRootPath

  VirDir.DefaultDoc=VirDir.DefaultDoc&"",""&strDefaultDoc

  VirDir.setInfo

  Iferr<>0Then

  MsgBox""創(chuàng)建虛擬目錄失敗!"",vbcritical

  Else

  MsgBox""虛擬目錄""&strVRName&""成功創(chuàng)建在服務(wù)器""&strServerName&""上!"",vbinformation

  EndIf

  代碼的關(guān)鍵在于創(chuàng)建虛擬目錄,及其中的配置:

  SetVirDir=objVirtualDir.Create(""IISWebVirtualDir"",strVRName)

  VirDir.AccessRead=true

  VirDir.Path=strRootPath

  VirDir.DefaultDoc=VirDir.DefaultDoc&"",""&strDefaultDoc

  VirDir.setInfo

【vbscript自動配置IIS代碼】相關(guān)文章:

數(shù)控編程代碼大全02-13

配置顯示器顏色配置文件方法教程12-02

Java代碼的基本知識09-03

網(wǎng)頁滾動文字的制作HTML代碼04-10

園路的植物配置方法10-13

dlink交換機配置方法07-16

二層組播的配置09-26

Cisco路由器配置命令08-22

常見的路由器配置錯誤01-06

汽車音響基本配置種類12-19