Before we dive in, let’s have a quick conversation about the “right way” to do things in PowerShell. One of PowerShell’s advantages—and one of its biggest disadvantages—is that it’s pretty happy to let you take a variety of approaches when you code. If you come from a VBScript background, PowerShell will let you write scripts that look a lot like VBScript. If you’re a C# person, PowerShell will happily run scripts that strongly resemble C#. But PowerShell is neither VBScript nor C#; if you want to take advantage of PowerShell and let it do as much heavy lifting for you as possible, you must understand the PowerShell way of doing things. We’ll harp on this a lot in this book, starting here. But it’s also important to keep in mind that just because we do things a certain way, that doesn’t mean it’s the only way—it’s just the way we prefer to do things. We generally follow the community’s best practices when it comes to scripting.