---
title: "PowerShell Pipeline Parameters: How to Create Pipeline-Ready Functions"
description: "Learn how to enable pipeline input in your custom PowerShell functions using parameter binding. This tutorial shows you how to use ValueFromPipeline and ValueFromPipelineByPropertyName to create functions that work seamlessly with the PowerShell pipeline."
canonical: "https://adamtheautomator.com/powershell-pipeline-parameters/"
---

# PowerShell Pipeline Parameters: How to Create Pipeline-Ready Functions

> Learn how to enable pipeline input in your custom PowerShell functions using parameter binding. This tutorial shows you how to use ValueFromPipeline and ValueFromPipelineByPropertyName to create functions that work seamlessly with the PowerShell pipeline.

Source: https://adamtheautomator.com/powershell-pipeline-parameters/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![PowerShell Pipeline Parameters: How to Create Pipeline-Ready Functions](https://adamtheautomator.com/wp-content/uploads/2024/12/featured-image-7.webp)

# PowerShell Pipeline Parameters: How to Create Pipeline-Ready Functions

[![](https://secure.gravatar.com/avatar/d0b9d42e21e5622713f8b693aa5c0f9244d5f7dd200ed29b8398f52dee5de337?s=192&d=mm&r=g)Adam Bertram](https://adamtheautomator.com/author/adam-bertram/)31 December 20242 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[PowerShell](/tag/powershell/)

Table of Contents

*   [Enabling Pipeline Input with ValueFromPipeline](#enabling-pipeline-input-with-valuefrompipeline)
*   [Binding by Property Name with ValueFromPipelineByPropertyName](#binding-by-property-name-with-valuefrompipelinebypropertyname)
*   [Conclusion](#conclusion)

You may have explored how the PowerShell pipeline works and how built-in cmdlets pass data from one command to another. But did you know you can create your own custom functions that also use the pipeline? Yes! With a _parameter binding_, your functions can act just like built-in cmdlets, seamlessly accepting data from the pipeline.

This tutorial will guide you to equipping your custom functions with the power of the pipeline, transforming how you automate and structure your PowerShell scripts.

Rather than relying on loops or manual inputs, unlock new levels of efficiency and flexibility in your scripting!

If you are turning these pipeline patterns into reusable automation, compare [Educative developer learning paths for interactive software engineering practice](https://educative.pxf.io/c/1454808/1657818/19245) before picking a paid developer-learning platform. It is most relevant when you want hands-on practice with maintainable functions, inputs, and testing habits after this PowerShell example.

## Enabling Pipeline Input with `ValueFromPipeline`

For your function to receive information from the pipeline, you must configure one or more parameters to accept it. You’ll configure parameters to use the `ValueFromPipeline` or `ValueFromPipelineByPropertyName` attribute.

Let’s start by setting up a function that installs software on multiple computers to pass an array of computer names to it without using a loop.

Add the `ValueFromPipeline` attribute to the `ComputerName` parameter, allowing each incoming pipeline object to be treated as the `ComputerName` parameter.

PowerShell will bind each incoming pipeline object to `$ComputerName` with this setup.

```powershell
function Install-Software {
    param(
        [Parameter(Mandatory)]
        [ValidateSet(1,2)]
        [int]$Version,

        [Parameter(Mandatory, ValueFromPipeline)]
        [string]$ComputerName
    )
    process {
        Write-Host "I installed software version $Version on $ComputerName. Yippee!"
    }
}
```

Now, pass an array of computer names to the function using the pipeline.

```powershell
$computers = @("SRV1", "SRV2", "SRV3")
$computers | Install-Software -Version 1
```

Without the `process` block, the function would only handle the last item. The `process` block allows the function to independently process each item in the array.

💡

PowerShell commands always return objects, and objects often have multiple properties. Binding can work with an entire object or a single property within that object, depending on the type of data your function needs to use.

With this flexibility, you can fine-tune your custom functions to handle the information you want from the pipeline, making your scripts even more powerful and efficient.

## Binding by Property Name with `ValueFromPipelineByPropertyName`

Perhaps you have multiple properties in your pipeline objects that need to match the parameters of your function. If so, let’s assume a CSV file contains both the `ComputerName` and `Version` fields.

To demonstrate binding by property name, start by saving a CSV file containing these properties:

```powershell
@(
    [pscustomobject]@{'ComputerName' = 'SRV1'; 'Version' = 1}
    [pscustomobject]@{'ComputerName' = 'SRV2'; 'Version' = 2}
    [pscustomobject]@{'ComputerName' = 'SRV3'; 'Version' = 2}
) | Export-Csv -Path C:\Scripts\software_installs.csv -NoTypeInformation
```

Update the function to accept `Version` and `ComputerName` by property name.

With `ValueFromPipelineByPropertyName`, the function matches properties in each object (such as those imported from a CSV) with parameters in the function.

```powershell
function Install-Software {
    param(
        [Parameter(Mandatory, ValueFromPipelineByPropertyName)]
        [ValidateSet(1,2)]
        [int]$Version,

        [Parameter(Mandatory, ValueFromPipelineByPropertyName)]
        [string]$ComputerName
    )
    process {
        Write-Host "I installed software version $Version on $ComputerName. Yippee!"
    }
}
```

Now, use `Import-Csv` to import the file and pipe each object to `Install-Software`.

```powershell
Import-Csv -Path C:\Scripts\software_installs.csv | Install-Software
```

Each row’s `ComputerName` and `Version` fields bind to the respective parameters in the function. This approach enables easy bulk processing of software installations across multiple computers with version control.

## Conclusion

In this tutorial, you learned how to enable pipeline support in PowerShell functions, making them more versatile and powerful. You can now design custom functions that seamlessly accept data from the pipeline, similar to built-in cmdlets.

With pipeline-enabled functions, you gain finer control over data input, simplifying script design and improving readability.

As you continue working with PowerShell, consider integrating these techniques to write efficient, pipeline-ready functions. Make your scripts more adaptable and effective in automating tasks!

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fpowershell-pipeline-parameters%2F&text=PowerShell%20Pipeline%20Parameters%3A%20How%20to%20Create%20Pipeline-Ready%20Functions)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fpowershell-pipeline-parameters%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fpowershell-pipeline-parameters%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2026/06/26995-troubleshoot-dns-issues-powershell-codex.webp)

### [Troubleshoot DNS Issues with PowerShell](/troubleshoot-dns-issues-powershell/)

Troubleshoot DNS issues with PowerShell by testing name resolution, DNS client settings, cache entries, and network connectivity in a repeatable workflow.

![](https://adamtheautomator.com/wp-content/uploads/2025/10/image_2025-10-24_095322075.png)

### [Migrating from PowerShell 6 to 7.5: Breaking Changes/New Features](/migrating-powershell-6-to-7-5/)

Migrate from PowerShell Core 6 to 7.5: breaking changes, features, and testing tips.

![](https://adamtheautomator.com/wp-content/uploads/2025/06/featured-image-6.png)

### [How to Add Timeouts to Pester Tests with PowerShell Runspaces](/pester-test-timeout-runspaces/)

Prevent Pester tests from hanging indefinitely using PowerShell runspaces. Learn to handle variable scoping, module loading, TestDrive access, and stream capture challenges with timeout protection.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
