Quantcast
Channel: Configuration & Scripting
Viewing all articles
Browse latest Browse all 780

Add-WebConfiguration or Add-WebConfigurationProperty

$
0
0

If I use the inetmgr GUI to add a field for logging, I see that the applicationHost.config file adds a line to the customFields element like this:

<siteDefaults>
<logFile logExtFileFlags="Date, Time, ClientIP, UserName, ServerIP, Method, UriQuery, HttpStatus, Win32Status, TimeTaken, ServerPort, UserAgent, Referer, HttpSubStatus" logFormat="W3C" directory="<MyPathToLogfiles>">
<customFields>
<clear />
<add logFieldName="REMOTEADDRESS" sourceName="REMOTEADDRESS" sourceType="RequestHeader" />
</customFields>
</logFile>
<traceFailedRequestsLogging directory="<MyPathToLogfiles>" />
</siteDefaults>

I have been trying to use Add-WebConfiguration or Add-WebConfigurationProperty in a script so it can be added to our install wrapper and having difficulty getting either cmdlet to add an entry.

I am trying these 2 commands and it is rejecting the -Name 'add' property:

Add-WebConfigurationProperty -Filter '/system.applicationHost/sites/siteDefaults/logFile/customFields' -Name 'add' -Value '@{logFieldName="REMOTEADDRESS";sourceName="REMOTEADDRESS";sourceType="RequestHeader"}'

Add-WebConfigurationProperty -Filter '/system.applicationHost/sites/siteDefaults/logFile/customFields' -Name 'add' -Value '@{logFieldName="X-FORWARDED-FOR";sourceName="X-FORWARDED-FOR";sourceType="RequestHeader"}'

Anyone have a clue how to add to the section customFields under the <clear /> tag?


Viewing all articles
Browse latest Browse all 780

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>