Curated Examples
Parse IIS logs from PowerShell
Read an IIS log file into PowerShell objects.
This pattern is useful for a first look at an IIS log without loading the entire file.
It is adapted from IISParser.PowerShell/CmdletGetIISParsedLog.cs.
Example
Import-Module IISParser
$logPath = Join-Path $PSScriptRoot 'samples\u_ex230101.log'
Get-IISParsedLog -FilePath $logPath -First 10 -Expand |
Select-Object Timestamp, ClientIP, Method, UriPath, StatusCode, TimeTakenMs
What this demonstrates
- using a script-local log path
- limiting the first pass to a small number of records
- expanding fields into PowerShell-friendly properties