IIS 7 & IIS 8
Configuration & Scripting
Programmatically use PoSH for getting IIS W3C logging fields?
Last post Mar 02, 2012 06:41 AM by jagojago12
Feb 28, 2012 11:35 PM|LINK
Newbie to this forum :)
Is there any way to use PoSH to grab what fields are selected in IIS W3C logging fields?
The closest I've research to is it appears this command can set the W3C logging fields.
Set-WebConfigurationProperty system.applicationHost/sites/siteDefaults -Name logFile.logExtFileFlags -Value "Date, Time, ClientIP, UserName, Method, UriQuery, HttpStatus, Referer"
I'm assming to get what I want I need to use Get-WebConfigurationProperty. How would I use this on the server itself? (i.e., when double-clicking on server name then selecting Logging in Inetmgr).
Feb 29, 2012 08:19 AM|LINK
Clint Huffman shared great powershell scripts. There is one about what you want (Get-IisLogConfiguration.ps1)
Get here : http://blogs.technet.com/b/clinth/archive/2011/12/04/my-iis7-powershell-scripts.aspx
Feb 29, 2012 09:11 PM|LINK
Thanks for the quick reply. I ran the script and it works well but the script reports logging for the IIS site level. I want to check logging that is set on the server level (double-clicking on the server name from inetmgr then selecting Logging).
Is this possible?
Mar 01, 2012 06:00 AM|LINK
It can be done by using following cmdlet:
Get-WebConfigurationProperty -filter //log/centralW3CLogFile -name logExtFileFlags -PSPath:IIS:\
Mar 02, 2012 06:41 AM|LINK