Powershell IIS高级日志记录-配置编辑器脚本出错
我正在编写一个PowerShell脚本,对一些服务器上已经存在的高级日志进行一些修改。我遇到的主要问题是使用Configuration Editor生成的以下命令:Powershell IIS高级日志记录-配置编辑器脚本出错,powershell,iis,appcmd,Powershell,Iis,Appcmd,我正在编写一个PowerShell脚本,对一些服务器上已经存在的高级日志进行一些修改。我遇到的主要问题是使用Configuration Editor生成的以下命令: .\appcmd.exe set config "wh01-02.testlab.com" -section:system.webServer/advancedLogging/server /+"logDefinitions.[baseFileName='Log404'].filter.condition.[operator='0'
.\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. )
这件事有点难办。有人吗 好的,算了。看起来我需要先创建“And”操作符,然后运行命令:
.\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