title: Add IIS 8.5 Custom Logging Fields with Powershell
body: <p>Windows Server 2012 R2 with IIS 8.5 allows for custom log fields with Enhanced Logging</p>
  
  <p><a href="http://www.iis.net/learn/get-started/whats-new-in-iis-85/enhanced-logging-for-iis85" rel="nofollow">http://www.iis.net/learn/get-started/whats-new-in-iis-85/enhanced-logging-for-iis85</a></p>
  
  <p>I want to add the fields with Powershell</p>
  
  <p>The following works:</p>
  
  <pre><code>Set-ItemProperty IIS:\Sites\siteName -name logfile.customFields.collection -value
   @{logFieldName='foo';sourceType='RequestHeader';sourceName='c-ip'}
  </code></pre>
  
  <p>But I cannot add a second entry to logfile.customFields.collection It requests -Force and overwrites the existing entry </p>
  
  <p>I added 2 via the GUI to illustrate the issue</p>
  
  <pre><code>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
  Methods        :
  Schema         : Microsoft.IIs.PowerShell.Framework.ConfigurationElementSchema
  </code></pre>
  
  <p>logFieldName, sourceName, and sourceType are NoteProperty Members with the same name</p>
  
  <p>How do I do this in Powershell?</p>