4CONTROL FLOW
Let’s do a quick recap. In Chapter 3, you learned how to combine commands by using the pipeline and external scripts. In Chapter 2, you learned how to use variables to store values. One of the major benefits of working with variables is they allow you to write code that deals with what a value means: instead of working with the number 3, for example, you’ll work with the more general $serverCount, so you can write code that runs the same whether you have one, or two, or a thousand servers. Combine this ability to write general solutions with the ability to store your code in a script that you can run on many computers, and you can ...
Get PowerShell for Sysadmins now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.