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

7.5. Writing the main code

Recall from the beginning of this chapter that we have two possible situations to deal with:

  • If objects are piped into the function, the PROCESS block will execute multiple times. Since we plan to pipe in computer names, that means $ComputerName would only contain one computer name each time PROCESS executes.
  • If data is provided solely via the function’s parameters, PROCESS will execute just once. For us, that means $ComputerName would contain a collection of multiple computer names when PROCESS executes.

We haven’t wired things up to even accept pipeline input yet, but we plan to, because we said so in our design. So we need to understand that $ComputerName might contain one name, or might contain multiple names. ...

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