O'Reilly logo

Learn PowerShell Toolmaking in a Month of Lunches by Don Jones and Jeffrey Hicks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4.3. Parameterize the command

Let’s consider what we’ve done so far, with the perspective of a toolmaker. We’ve created this script, which can query information from a remote computer. We want to give this to someone else to use. But they’re likely to want to query other computers as well as the one we’ve been testing with. We could just tell them, “Look, whenever you want to use this, open it up in Notepad or the ISE. You have to change the computer name, but be sure not to change anything else, or you could break it.” What could possibly go wrong?

It would make a lot more sense to not have other folks editing our script on a routine basis—the less they edit, the less they’ll break. Besides, when someone runs a regular PowerShell command, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required