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.