Events Are Easy

Events are easy.Events let you know when something happened, and respond to it if you choose. Events are incredibly useful. Why? Because they let you run what you want, when you want. Let's see how simple they are: Creating Events Events are easy to create. To make a new event, simply run: New-Event MyCustomEvent This will output an event object. If nothing subscribes to the event, the event will go in the queue We can get events with: Get-Event We can handle these events whenever we want. How about now? Subscribing to Events We can run code the millisecond something happens. To do this, we can subscribe to the event. There are two types of events we can subscribe to in PowerShell: Engine
…