PowerShell Accepting Pipeline Input. There are two ways to accept pipeline input
- ValueFromPipeline = $true
- ValueFromPipelineByPropertyName = $true
Prerequisite
[cmdletbinding()]
Param
(
[Parameter(ValueFromPipeline)]] OR [Parameter(ValueFromPipelineByPropertyName)]]
)
ValueFromPipeline
This method accepts the whole object as input and gives you access to all of the objects properties.
ValueFromPipelineByPropertyName
This method accepts only the value of a single property.
Equivalent of $Object | Select-Object -ExpandProperty Name
Related
- Hashing in Windows
- Changing Windows Network Profile
- How to check for Suspicious root CA certificates in Windows
- How to Start an Application as Another User from the Command Line in WIndows
- How to turn the Windows Firewall On or Off Via the Command Line
- How to setup WinRM in a WorkGroup Non Domain Environment
- Moving AD Computer Object with Powershell
- Install PowerShell Core on Raspberry Pi OS
- Rounding Numbers in PowerShell
Links
- https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_pipelines?view=powershell-7.1