Parameters in calls to functions in PowerShell (all versions) are space-separated, not comma-separated. Also, the parentheses are entirely unnecessary and will cause a parse error in PowerShell 2.0 (or later) if Set-StrictMode -Version 2 or higher is active. Parenthesised arguments are used in .NET methods only.

function foo(b, $c) {
   "a: b; c: $c"
}

Execute:

foo 1 2 3

Output:

a: 1; b: 2; c: 3
Answer from x0n on Stack Overflow
🌐
SharePoint Diary
sharepointdiary.com › sharepoint diary › powershell › powershell function parameters: a beginner’s guide
PowerShell Function Parameters: A Beginner's Guide - SharePoint Diary
August 1, 2025 - Here’s a simple function that takes two integer parameters and returns their sum: ... In this example, we defined two parameters: $num1 and $num2. The data type for both parameters is [int], meaning they should be integers. You can add Additional parameters in the same way by separating them with a comma. PowerShell also has an automatic variable $args, which contains an array of the parameter values that are passed to a function, script, or script block.
🌐
TechTarget
techtarget.com › searchwindowsserver › tip › Understanding-the-parameters-of-Windows-PowerShell-functions
Understanding Windows PowerShell function parameters | TechTarget
Learn to use Windows PowerShell function parameters, with information on defining parameters; named, positional and switch parameters; and splatting.
🌐
Microsoft Learn
learn.microsoft.com › en-us › powershell › module › microsoft.powershell.core › about › about_functions_advanced_parameters
about_Functions_Advanced_Parameters - PowerShell | Microsoft Learn
PowerShell generates an error if the parameter value refers to drives other than the allowed. Existence of the path, except for the drive itself, isn't verified. If you use relative path, the current drive must be in the allowed drive list. param( [ValidateDrive("C", "D", "Variable", "Function")] [string]$Path )
🌐
Practical 365
practical365.com › home › microsoft 365 › practical powershell: functions & parameterization
Practical PowerShell: Functions & Parameterization | Practical365
July 11, 2024 - For example, if you pass -Verbose and your function contains Write-Verbose commands, verbose output will be displayed. When you omit -Verbose, the output is not displayed. Position=0 in the first parameter specification instructs PowerShell that the first unnamed parameter passed to Get-DistributionGroupInfo is treated as the Identity.
🌐
Microsoft Learn
learn.microsoft.com › en-us › powershell › module › microsoft.powershell.core › about › about_functions
about_Functions - PowerShell | Microsoft Learn
CommandType Name ModuleName ----------- ---- ---------- Cmdlet Get-ChildItem Microsoft.PowerShell.Management · The @args feature uses the $args automatic parameter, which represents undeclared cmdlet parameters and values from remaining arguments. For more information, see about_Splatting. Any function can take input from the pipeline. You can control how a function processes input from the pipeline using begin, process, end, and clean keywords. The following sample syntax shows these keywords: The process statement list runs one time for each object in the pipeline.
🌐
EDUCBA
educba.com › home › data science › data science tutorials › powershell tutorial › powershell function parameters
PowerShell Function Parameters | Working | Examples
March 6, 2023 - There are different named parameter attributes like Mandatory, ValueFromPipeline, Position, ParameterSetName, etc. Typename is the datatype for the ParameterName like String, Integer, Character.
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
Find elsewhere
🌐
Microsoft Learn
learn.microsoft.com › en-us › powershell › scripting › learn › ps101 › 09-functions
Functions - PowerShell | Microsoft Learn
February 6, 2026 - Don't hardcode values; use parameters and variables. Don't write unnecessary code even if it doesn't hurt anything. It adds unnecessary complexity. Attention to detail goes a long way when writing any PowerShell code. When naming your functions in PowerShell, use a Pascal case name with an approved verb and a singular noun. To obtain a list ...
🌐
Adam the Automator
adamtheautomator.com › powershell-parameter
PowerShell Parameters: Unlock the Power of Scripting
October 1, 2023 - To limit the user to what you expect them to input, you can add some PowerShell parameter validation. There are various kinds of parameter validation you can use. For a full listing, run Get-Help about_Functions_Advanced_Parameters.
🌐
4sysops
4sysops.com › home › blog › popular › the powershell function – parameters, data types, return values
The PowerShell function – Parameters, data types, return values
July 28, 2023 - Functions in PowerShell allow you to combine multiple statements and improve the reusability of your code. In this post, you will learn how to scope functions, define parameters, assign data types, and return values.
🌐
SS64
ss64.com › ps › syntax-args.html
How-to: Pass parameters to a PowerShell script.
leaving out the = $true in this way will prevent the script from running in PowerShell 1.0 or 2.0) Param ( [Parameter(ValueFromPipelineByPropertyName)] [string] $DemoParameter ) In an Advanced Function, the params statement block can also optionally define parameter attributes:
🌐
Red Gate Software
red-gate.com › home › powershell parameters: a practical guide
PowerShell Parameters: A Practical Guide | Simple Talk
September 17, 2019 - Learn how to use parameters in PowerShell scripts using $args, named parameters, and the Param() block. Includes examples for passing arguments, setting defaults, and making parameters mandatory.
🌐
PowerShell is fun
powershellisfun.com › 2024 › 05 › 17 › parameters-for-powershell-scripts-and-functions
PowerShell is fun :)Parameters for PowerShell Scripts and Functions
May 17, 2024 - You can see that running the switch.ps1 script with the -filename parameter will display the contents of the powershellisfun.txt on your screen. The -GridView parameter with a $false value will also be outputted on your screen.
🌐
Wikiversity
en.wikiversity.org › wiki › PowerShell › Functions
PowerShell/Functions - Wikiversity
April 19, 2020 - By default, PowerShell arguments are passed by position. Parameter names may be used to identify parameters, bypassing position. 21. The $args array variable may be used to _____. The $args array variable may be used to access a variable length parameter list. 22. A recursive function definition has _____, and _____.
🌐
powershell.one
powershell.one › powershell-internals › attributes › parameters
Designing Professional Parameters - powershell.one
March 2, 2020 - function Test-This { # define parameters param ( # variables define one or more parameters # this is a comma-separated list! $Name = $env:username, # <-- don't forget the comma!
🌐
PowerShell Test-Path
powershellfaqs.com › powershell-function-examples-with-parameters
PowerShell Function Examples with Parameters
July 6, 2024 - Function Call: The function is called with the -Name and -Age parameters, passing the values "Bob" and 30, respectively. You can see the output in the screenshot below after I executed the PowerShell script above.