31 lines
860 B
PowerShell
31 lines
860 B
PowerShell
|
[CmdletBinding()]param(
|
||
|
[Parameter(Position=1)]
|
||
|
[string]$Message,
|
||
|
[Parameter(ParameterSetName='Default',Mandatory,Position=0,ValueFromPipeline)]
|
||
|
[object[]]$InputObject,
|
||
|
[Parameter(ParameterSetName='Default')]
|
||
|
[Parameter(ParameterSetName='AssumeYes',Mandatory)]
|
||
|
[switch]$AssumeYes,
|
||
|
[Parameter(ParameterSetName='Default')]
|
||
|
[Parameter(ParameterSetName='AssumeNo',Mandatory)]
|
||
|
[switch]$AssumeNo
|
||
|
)
|
||
|
|
||
|
begin {
|
||
|
Write-Host -ForegroundColor Cyan "$Var"
|
||
|
$whereAskYesToAll = $AssumeYes
|
||
|
$whereAskNoToAll = $AssumeNo
|
||
|
}
|
||
|
process {
|
||
|
Write-Host -ForegroundColor Green "$Var"
|
||
|
foreach( $local:o in $InputObject ) {
|
||
|
if( $PSCmdlet.ShouldContinue(
|
||
|
$($o | Out-String),
|
||
|
$Message,
|
||
|
[ref]$whereAskYesToAll, [ref]$whereAskNoToAll)
|
||
|
) {
|
||
|
$o
|
||
|
}
|
||
|
}
|
||
|
}
|