Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
169 views
in Technique[技术] by (71.8m points)

iis 6 - How can you set IIS6 settings via the command line

I'm using a continuos build server (Finalbuilder) to create some IIS6 websites. However Finalbuilder does not have an option to set "Enable anonymous access" to true.

Is there a command line option that given a servername, physical directory, etc that I can enable anonymous access from the command line? In IIS7 there is appcmd.exe, but I can't find an equivliant for IIS6.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I used cscript.exe to execute the following:

Dim Siteobj
Dim Site
Dim SiteName
Dim SiteId
Dim SiteLocation

SiteName=WScript.Arguments( 0 )

Set SiteObj = GetObject("IIS://localhost/W3SVC")

for each Site in Siteobj

  if Site.keytype="IIsWebServer" Then  

    if Site.ServerComment = SiteName Then

      SiteId=Site.Name     

      SiteLocation = "IIS://LocalHost/w3svc/" & SiteId
      SiteLocation = SiteLocation & "/root"

      Dim SiteObj1
      Set SiteObj1  = GetObject(SiteLocation)
      SiteObj1.authflags=5
      SiteObj1.SetInfo

   Dim objFSO 'As FileSystemObject
    Dim objTextFile 'As Object

    Const ForReading = 1
    Const ForWriting = 2
    Const ForAppending = 8

    'write the siteid to a file to use in other scripts
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objTextFile = objFSO.CreateTextFile("siteid.txt", True)
    objTextFile.Write (SiteId)
    objTextFile.Close


    End if    
  End if 
Next

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...