# Reading IIS logs with PowerShell

Today I was reading Twitter, as I am pretty addicted to technology news when Adam Bacon mentioned that he’s surprised that no one has rebuilt IIS Parser as pure PowerShell. While this is not entirely true, and some modules can do some parsing, I decided to try my luck. While doing it from scratch in PowerShell is possible, I opted to use an external C# library that does all the heavy lifting and is optimized for speed.

blog

04 Jun 2022 es

![Reading IIS logs with PowerShell](/wp-content/uploads/2022/06/Pasted-1.png)

[Ver imágenes (2)](#pf-content-image-1-0)

Today I was reading Twitter, as I am pretty addicted to technology news when Adam Bacon mentioned that he's surprised that no one has rebuilt **IIS Parser** as pure **PowerShell**. While this is not entirely true, and some modules can do some parsing, I decided to try my luck. While doing it from scratch in **PowerShell** is possible, I opted to use an external **C# library** that does all the heavy lifting and is optimized for speed.

### 💡 Using IISParser to read IIS Logs

So after about 1 hour of playing with the library and creating a new **PowerShell** module called [**IISParser**](https://github.com/EvotecIT/IISParser), here we are. We now have an easy-to-use **PowerShell** function to **read IIS Logs**.

```generic
Get-IISParsedLog -FilePath "C:\Support\GitHub\IISParser\Ignore\u_ex220507.log" | Select-Object -First 5 | Format-Table
Get-IISParsedLog -FilePath "C:\Support\GitHub\IISParser\Ignore\u_ex220507.log" | Select-Object -First 5 -Last 5 | Format-Table
```

[!\[IIS Logs Parser in PowerShell\](/wp-content/uploads/2022/06/Pasted-1.png)](/wp-content/uploads/2022/06/Pasted-1.png)

Of course, when using **Format-Table,** we are not shown all the columns, but if we force the output using **Format-List,** we get all the **IIS properties**.

```generic
Get-IISParsedLog -FilePath "C:\Support\GitHub\IISParser\Ignore\u_ex220507.log" | Select-Object -First 5 -Last 5 | Format-List
```

[!\[IISParsers All Properties\](/wp-content/uploads/2022/06/Pasted-2.png)](/wp-content/uploads/2022/06/Pasted-2.png)

### 💡 Installing and updating IISParser

How do you install it? The easiest and most optimal way is to use **PowerShellGallery**. This will get you up and running in no time. Whenever there is an update, just run **Update-Module,** and you're done.

```generic
Install-Module IISParser
# Update-Module IISParser
```

However, if you're into code – want to see how everything is done, you can use **GitHub** sources. Please keep in mind that the **PowerShellGallery** version is optimized and better for production use. If you see any issues, bugs, or features that are missing, please make sure to submit them on **GitHub**.

- 💡 Code is published as a module on [PowerShellGallery](https://www.powershellgallery.com/packages/IISParser/)
- 💡 Issues should be reported on [GitHub](https://github.com/EvotecIT/IISParser/issues)
- 💡 Code is published on [GitHub](https://github.com/EvotecIT/IISParser)

## Proyectos relacionados

Proyectos que encajan con las etiquetas, categorías y contenido de este artículo.

[Todos los proyectos](/es/proyectos/)

Buscando proyectos relacionados...

[Volver al blog](/blog)

## Artículos relacionados

- [Check an API write after a PowerShell timeout](/es/blog/verify-uncertain-api-outcomes-powershell/)
- [Compose PDF reports and automate page workflows with PSWriteOffice](/es/blog/automate-pdf-reports-and-page-workflows-pswriteoffice/)
- [ImagePlayground: image automation that stays in PowerShell](/es/blog/imageplayground-powershell-image-automation/)

<!-- PowerForge markdown artifact sha256:C9B3CFECE2DF9D60FFC7E61B998BABA3BB0DEA76CDCADEFAC01A93E96634FA97 -->
