【问题标题】:IIS Advanced Logging - Error with Configuration Editor scriptIIS 高级日志记录 - 配置编辑器脚本出错
【发布时间】:2018-03-29 17:02:30
【问题描述】:

我正在编写一个 PowerShell 脚本来对一些服务器上已经存在的高级日志进行一些修改。我遇到的主要问题是使用配置编辑器生成的以下命令:

.\appcmd.exe set config "wh01-02.testlab.com" -section:system.webServer/advancedLogging/server /+"logDefinitions.[baseFileName='Log404'].filter.condition.[operator='0'].[field='Status',operator='Equals',value='404']" /commit:apphost

当我运行此脚本时,我收到以下错误:

ERROR ( message:Cannot find requested collection element. )

有点难倒这个。任何人的想法?

【问题讨论】:

    标签: powershell iis appcmd


    【解决方案1】:

    好的,想通了。看起来我需要先创建“与”运算符,然后运行命令:

    .\appcmd.exe set config "wh01-02.testlab.com" -section:system.webServer/advancedLogging/server /+"logDefinitions.[baseFileName='Log404'].filter.condition.[operator='And']" /commit:apphost
    .\appcmd.exe set config "wh01-02.testlab.com" -section:system.webServer/advancedLogging/server /+"logDefinitions.[baseFileName='Log404'].filter.condition.[operator='And'].[field='Status',operator='Equals',value='404',caseSensitive='False',regularExpression='False']" /commit:apphost
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-06-06
      • 1970-01-01
      • 2012-10-29
      • 1970-01-01
      • 2020-05-16
      • 2015-01-13
      • 2020-02-08
      相关资源
      最近更新 更多