Yes, this happens in all previous versions
function Test-Parameter {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true, HelpMessage = "Please input a Process object")]
[System.Diagnostics.Process] $input
)
Write-Host -Object $input.Description;
}
$Process = (Get-Process)[10]; # Get a System.Diagnostics.Process object
Write-Host -Object $proc.GetType().FullName; # Make sure we actually have a System.Diagnostics.Process object
Test-Parameter; # Call the Test-Parameter function. When prompted for input
# plug in $Process.
#######################################
function Test-Parameter {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true, HelpMessage = "Please input a Process object")]
[bool] $TrueOrFalse
)
Write-Host -Object $TrueOrFalse;
}
Test-Parameter; # When prompted, type $false. The function returns $true, because the inputs is evaluated as a string.
You should be able to specify variable input when prompted to input parameter values. For boolean values, you should be able to input $true or $false when prompted. For arbitrary objects, you should be able to specify a variable that contains the object you want to use as input.