you should call like below
function weekendplans($a,$b,$c)
{
$message = "This is a $a $b and an $($c)"
$message
}
weekendplans "pear" "apple" "orange"
with the way you passed, all arguments are assigned to $a
function weekendplans($a,$b,$c)
{
Write-Host "a is $a"
Write-host "b is $b"
Write-host "c is $c"
$message = "This is a $a $b and an $c"
$message
}
PS C:\> weekendplans("pear", "apple", "orange")
running above gives me
a is pear apple orange
b is
c is
This is a pear apple orange and an
Correct way to Pass Parameters in power shell is through space separated and not by comma
if you are not aware, you can call .NetClasses
in powershell ,they are called comma seperated.Below is one example
[System.DateTime]::DaysInMonth(2020,6)
Parenthesised arguments are used in .NET methods only
Parameters in calls to functions in PowerShell (all versions) are space-separated, not comma separated. Also, the parentheses are entirely unneccessary and will cause a parse error in PowerShell 2.0 (or later) if Set-StrictMode is active. Parenthesised arguments are used in .NET methods only.
Further reading and References:
How do I pass multiple parameters into a function in PowerShell?