如何通过命令行设置IIS6设置 [英] How can you set IIS6 settings via the command line

查看:86
本文介绍了如何通过命令行设置IIS6设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Continuousos构建服务器(Finalbuilder)创建一些IIS6网站.但是,Finalbuilder无法将启用匿名访问"设置为true.

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.

是否有给定服务器名,物理目录等的命令行选项,我可以从命令行启用匿名访问?在IIS7中有appcmd.exe,但是我找不到与IIS6相当的东西.

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.

推荐答案

我使用cscript.exe执行以下操作:

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

这篇关于如何通过命令行设置IIS6设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆