Chapter 19. From command to script to function

Let’s say that you’ve come up with a great command that you not only want to use again and again, but you want to share with your colleagues and co-workers. It’s a somewhat complicated command, so you want to put it into a batch file for them. There are also one or two things that need to change each time you run the command, such as a computer name or other parameter, so you want to make it easy for them to provide that information. PowerShell makes it easy to do all of that, and you’re going to see how in this chapter.

19.1. Turning a command into a reusable tool

If I’ve said it once, I’ve said it a million times: you don’t need to be a programmer to do amazing things with PowerShell. Given ...

Get Learn Windows PowerShell in a Month of Lunches 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.