Skip to content

Instantly share code, notes, and snippets.

@pashalvov
Created February 7, 2022 12:25
Show Gist options
  • Save pashalvov/bb025b272ef4d8d19decae718ad0cc0d to your computer and use it in GitHub Desktop.
Save pashalvov/bb025b272ef4d8d19decae718ad0cc0d to your computer and use it in GitHub Desktop.
Тест pipe в функции Powershell
function Test-PipeInFunction
{
[CmdletBinding()]
[Alias()]
[OutputType([String])]
Param
(
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
ValueFromRemainingArguments=$false,
Position=0)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
$Param1
)
Begin
{
'Call first begin block with Param: ' + $Param1
'Call second begin block with $_: ' + $_
}
Process
{
'Call process block: ' + $Param1
}
End
{
'Call end block: ' + $Param1
}
}
$Array = '1','2','3'
$Array | Test-PipeInFunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment