Mandatory Parameters
suggest changeParameters of a function can be marked as mandatory.
function Get-Greeting{
param
(
[Parameter(Mandatory=$true)]$name
)
"Hello World $name"
}
If the function is invoked without a value, PowerShell prompts for the value:
$greeting = Get-Greeting
cmdlet Get-Greeting at command pipeline position 1
Supply values for the following parameters:
name:
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents