Build a PowerShell Tool for Windows Event and Text Log Analysis
In this lab, you’ll practice building a PowerShell tool to analyze Windows event logs and text files. When you’re finished, you’ll have a functioning script to scan activity in a given timeframe.
Terms and conditions apply.
Lab info
Lab author
Challenge
Getting Started in the Lab Environment
Here are the initial instructions and explanation of the lab environment. Read this while your environment is busy creating itself from nothing. Yes, this violates physics; we know. How fun!
Challenge
Brainstorm and Sketch Out a Tool
You will start to create a PowerShell script to audit a server.
Challenge
Use Get-WinEvent to Query Window Event Logs
Explore the full event logs, and then gradually apply filters to retrieve specific logs, understanding why filtering is crucial.
Challenge
Find Local Storage Volumes
Learn how to filter local drives by root paths, and search recursively for specific file types within those drives.
Challenge
Search all Local Storage Volumes for Log Files
Using Get-ChildItem, learn how to interrogate text log files on your local storage volumes.
Challenge
Add Script Parameters
Make the tool more dynamic by creating a holistic script that runs together with parameters.
Challenge
Add CSV Output
In this challenge, you will learn to export the records found into a CSV file, rather than just outputting them via the console. Saving to a CSV file will allow you to quickly parse and share the results of your script with others.
Challenge
Add Simple Error Handling
In this final challenge, you will learn to incorporate basic error handling into your tool. You’ll learn about the $Error variable, non-terminating and terminating errors.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.
Recommended prerequisites
- Intermediate level PowerShell knowledge
- Beginner level knowledge of Visual Studio Code.
- An understanding of what data can be contained in event and text logs