How to change the IIS log contents with PowerShell
How to change the IIS log contents with PowerShell
Ever want to change the type of information contained in your IIS logs? While the default settings are useful, there’s much more data you could be collecting. Graphical you can do this on a per server bases in the “Logging” feature and selecting the “Select Fields” option.
My problem is that I want to set this on several web servers. You can do this using PowerShell Remoting and the Set-WebConfigurationProperty cmdlet from the WebAdministration module.
To get a list of the current fields:
PS> $Session=New-PsSession –ComputerName Web1, Web2, Web3
PS> Invoke-Command –Session $Session {
Get-WebConfiguration –filter system.applicationhost/sites/sitedefaults/logfile |
Select-Object -ExpandProperty logExtFileFlags }
To change the list using the same Remoting session:
Invoke-Command –Session $session {
Set-WebConfigurationProperty -Filter System.Applicationhost/Sites/SiteDefaults/logfile -Name LogExtFileFlags -Value “Date,Time,ClientIP”}
Have fun!
Knowledge is PowerShell
Jason
Jason Helmick
Director of PowerShell Technologies
Interface Technical Training
You May Also Like
IIS, IIS logs, Powershell, PowerShell Remoting, W3C, WebConfigurationProperty
Creating Users and Managing Passwords in Microsoft Office 365
0 706 3In this Office 365 training video, instructor Spike Xavier demonstrates how to create users and manage passwords in Office 365. For instructor-led Office 365 training classes, see our course schedulle: Spike Xavier SharePoint Instructor – Interface Technical Training Phoenix, AZ 20347: Enabling and Managing Office 365
Using Navigation Controls in a Collaboration Site in SharePoint
0 343 1In this SharePoint training video, I want to talk about the Navigation Controls in SharePoint. They tend to fall into two kind of different categories; one with the navigation controls in a typical Collaboration Site such as a Team Site or a Project Site. These are Sites that are based on the Team Site Template … Continue reading Using Navigation Controls in a Collaboration Site in SharePoint
How to clone a Windows Server 2012 or 2012 R2 Domain Controller
3 1604 3One of the coolest new features in Window Server 2012 and Windows Server 2012 R2 is the ability to clone a Domain Controller. In the past, if we had virtualized Domain Controllers and we actually took a snapshot of it and then rolled back to that snapshot, it would break the logon service on that … Continue reading How to clone a Windows Server 2012 or 2012 R2 Domain Controller