How To Accept Multiple Values From Pipeline Into A Powershell Function

1. steps

  1. In func1, explicitly expects a list of strings as an input type [String[]]
  2. In func2, explicitly declare the parameter as an array of strings [String[]], not just a string with ValueFromPipeline = $true.
  3. In func2, you will need to use the begin{}, process{}, end{} — even though some of those blocks are just declared/empty
  4. IN func2, it does not work if you replace $match with $_ to make it more readable
  • regex support is built-in, don’t be shy to use it in lookups, see ami_size.*
▶ query-consul org.acme_prod,com.acme_dev,net.acme_qa ami_size.* | print-matches-only

ami_size:large
ami_size:large
ami_size:large

2. links

Infrastructure Support Engineer/Technical Writer (Snowplow Analytics) with a passion for Python/writing documentation. More about me: https://pavol.kutaj.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

TYPE casting in python | quick revision

A Gentle Introduction to Amazon Web Services — Simple English Explanations for Product Categories

RudderStack Product News — Vol.

Easy HTTPS and .WWW Redirect on AWS

Import a QBO file into Quickbooks Desktop for Windows

Intro to Leo Programming Language

Ways of talking with your data

Ideas that help you leveling software development up

A bunch of people discussing in front of acomputer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pavol Kutaj

Pavol Kutaj

Infrastructure Support Engineer/Technical Writer (Snowplow Analytics) with a passion for Python/writing documentation. More about me: https://pavol.kutaj.com

More from Medium

On The Value Of Tactics With Powershells Multiple Find And Replace Oneliner

Linux Filesystem and User Permissions

Unblocking Files with PowerShell

Shell Commands 05: Linux Server Resources