Behind the PowerShell Pipeline logo

Behind the PowerShell Pipeline

Subscribe
Archives
October 6, 2022

Events Happen

Today’s topic came to me from a reader and is an advanced PowerShell topic. It is something that you might find useful as an interactive management tool or something you might incorporate into your PowerShell scripts. The subject is eventing.

Windows is an event-driven operating system. It reacts to the user. When you click a mouse button, an event happens. When a service stops, an event occurs. When a process starts, an event happens. This concept manifests itself in PowerShell as well. PowerShell has a set of commands devoted to this concept. This means that you can write a PowerShell script that says, “if this event happens, run these commands.”

Working with events can be tricky because, by their nature, you can’t predict when they will occur. In PowerShell this means we’re often writing code work with non-interactive situations. But before I get too far, let’s start with some basics.

Event Basics

Want to read the full issue?
GitHub Bluesky LinkedIn About Jeff
Powered by Buttondown, the easiest way to start and grow your newsletter.