相关疑难解决方法(0)

使用 Powershell 添加 IIS 8.5 自定义日志记录字段

带有 IIS 8.5 的 Windows Server 2012 R2 允许使用增强日志记录自定义日志字段

http://www.iis.net/learn/get-started/whats-new-in-iis-85/enhanced-logging-for-iis85

我想用 Powershell 添加字段

以下工作:

Set-ItemProperty IIS:\Sites\siteName -name logfile.customFields.collection -value
 @{logFieldName='foo';sourceType='RequestHeader';sourceName='c-ip'}
Run Code Online (Sandbox Code Playgroud)

但我无法向 logfile.customFields.collection 添加第二个条目 它请求 -Force 并覆盖现有条目

我通过 GUI 添加了 2 来说明问题

Get-ItemProperty IIS:\Sites\siteName -name logfile.customFields.collection

logFieldName   : foo
sourceName     : c-ip
sourceType     : RequestHeader
Attributes     : {logFieldName, sourceName, sourceType}
ChildElements  : {}
ElementTagName : add
Methods        :
Schema         : Microsoft.IIs.PowerShell.Framework.ConfigurationElementSchema

logFieldName   : foo2
sourceName     : c-servername
sourceType     : RequestHeader
Attributes     : {logFieldName, sourceName, sourceType}
ChildElements  : {}
ElementTagName : add …
Run Code Online (Sandbox Code Playgroud)

iis powershell

4
推荐指数
1
解决办法
2860
查看次数

标签 统计

iis ×1

powershell ×1