Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

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

1 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...