Mandatory Parameters

suggest change

Parameters to 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, the command line will prompt for the value:

$greeting = Get-Greeting 

cmdlet Get-Greeting at command pipeline position 1
Supply values for the following parameters:
name:

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


PowerShell functions:
* Mandatory Parameters

Table Of Contents
1 Loops
9 PowerShell functions
19 XML
22 Strings
25 Aliases
47 MongoDB
65 AWS S3