Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell IIS高级日志记录-配置编辑器脚本出错_Powershell_Iis_Appcmd - Fatal编程技术网

Powershell IIS高级日志记录-配置编辑器脚本出错

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'

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

.\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