Skip to content

Instantly share code, notes, and snippets.

@Agazoth
Last active February 1, 2025 06:56
Show Gist options
  • Save Agazoth/94c49d55be4733a1ac0cede2896ab4ad to your computer and use it in GitHub Desktop.
Save Agazoth/94c49d55be4733a1ac0cede2896ab4ad to your computer and use it in GitHub Desktop.
ValueFromPipeline
function Test-ValueFromPipeline {
[CmdletBinding()]
param (
[Parameter(Mandatory, ValueFromPipeline)]
[string]
$MyString,
[switch]
$MySwitch)
begin {
Write-Host "Begin $MyString"
Write-Host $MySwitch
}
process {
Write-Host "Process $MyString"
Write-Host $MySwitch
}
End {
Write-Host "Ended $MyString"
Write-Host $MySwitch
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment