Chapter 21. You call this scripting?

 

So far, you could’ve accomplished everything in this book by using PowerShell’s command-line interface. You haven’t had to write a single script. That’s a big deal for us, because we see a lot of administrators initially shying away from scripting, (rightly) perceiving it as a kind of programming, and (correctly) feeling that learning it can sometimes take more time than it’s worth. Hopefully, you’ve seen how much you can accomplish in PowerShell without having to become a programmer.

But at this point, you may also be starting to feel that constantly retyping the same commands, over and over, is going to become pretty tedious. You’re right, so in this chapter we’re going to dive into PowerShell scripting—but we’re still not going to be programming. Instead, we’re going to focus on scripts as little more than a way of saving our fingers from unnecessary retyping.

21.1. Not programming, more like batch files

21.2. Making commands repeatable

21.3. Parameterizing commands

21.4. Creating a parameterized script

21.5. Documenting your script

21.6. One script, one pipeline

21.7. A quick look at scope

21.8. Lab

21.9. Lab answer

sitemap