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
🌐
Stack Overflow
stackoverflow.com › questions › 73318836 › powershell-profile-script-with-input-parameters
Powershell profile script with input parameters - Stack Overflow
Thanks! You found the issue: in my profile file it read: function script {C:\path\to\script.ps1} which worked just fine until I added the parameters. With the parameters only your suggestion works.
🌐
Microsoft Learn
learn.microsoft.com › en-us › powershell › module › microsoft.powershell.core › about › about_functions
about_Functions - PowerShell | Microsoft Learn
January 18, 2026 - If you don't use one of the keywords (begin, process, end, clean) in a function definition, PowerShell puts the statements in the end block. For more information about the dynamicparam keyword and dynamic parameters in functions, see about_Functions_Advanced_Parameters.
Discussions

syntax - How do I pass multiple parameters into a function in PowerShell? - Stack Overflow
If I have a function which accepts more than one string parameter, the first parameter seems to get all the data assigned to it, and remaining parameters are passed in as empty. A quick test script: More on stackoverflow.com
🌐 stackoverflow.com
What’s in your Powershell profile
I found this when I looked at my home profile. function Get-WhatToEat { $list = @( 'Burger' 'Soup' 'Pizza' 'Tacos' 'Chicken Sandwich' 'Grilled Cheese' 'Food?' ) Clear-Host Get-Random $list } More on reddit.com
🌐 r/PowerShell
87
71
October 6, 2024
metadata - Powershell functions defined in profile - Stack Overflow
I have a function called GreatFuncion1 defined in "profile.ps1" loads when powershell launches and works ok how can I get the path where this function was defined from Powershell? usually... More on stackoverflow.com
🌐 stackoverflow.com
How can I set an alias with default parameters for a command in powershell?
Make the alias a function? More on reddit.com
🌐 r/PowerShell
16
32
December 26, 2020
🌐
Practical 365
practical365.com › home › microsoft 365 › practical powershell: functions & parameterization
Practical PowerShell: Functions & Parameterization | Practical365
July 11, 2024 - This advanced function contains the following enhancements: [CmdletBinding()] before the first parameter definition tells PowerShell that the function supports common parameters. Examples of common parameters are Verbose and Confirm. You can then include code in your function to support this.
🌐
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.
🌐
SS64
ss64.com › ps › syntax-functions.html
How-to: PowerShell Functions and Filters
So if you close and reopen PowerShell, the function/filter will no longer be available. To make a function permanently available, add it to your PowerShell $Profile it will then be loaded for every new PowerShell session and can be called from multiple different scripts without having to be ...
🌐
The Lonely Administrator
jdhitsolutions.com › powershell 7 › profile powershell functions
Profile PowerShell Functions • The Lonely Administrator
January 17, 2022 - I should also point out that the profile can't distinguish between the 'foreach' alias of ForEach-Object and the 'foreach' keyword. But this gives me enough information to know what I should look for when writing a PowerShell function. A few last points about the output. The ParameterSets property ...
Find elsewhere
🌐
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 - Use default values for optional parameters. To use a PowerShell function in all your PowerShell sessions, add it to the PowerShell profile.
🌐
Microsoft
devblogs.microsoft.com › dev blogs › scripting blog [archived] › hey, scripting guy! how can i add a function to a profile in windows powershell?
Hey, Scripting Guy! How Can I Add a Function to a Profile in Windows PowerShell? - Scripting Blog [archived]
November 26, 2009 - You do not want to go to all the trouble of editing your profile, and restarting Windows PowerShell only to find out there is a conflict with your alias choice. My first choice for an alias for the Get-Profile function would be gp. To see if it is available, use the Get-Alias cmdlet as seen here: ... As you can see, the alias gp is already taken unfortunately. We have two options, remove the gp alias by using the Remove-Item cmdlet, or choose something else. To remove the gp alias, you will need to use the Force parameter.
🌐
Reddit
reddit.com › r/powershell › what’s in your powershell profile
r/PowerShell on Reddit: What’s in your Powershell profile
October 6, 2024 -

Hi All,

I’ve recently been adding some helpful functions into my Powershell profile to help with some daily tasks and general helpfulness. I have things like a random password string generator, pomodoro timer, Zulu date checker etc to name a few.

What are some things everyone else has in their profile ?

🌐
Stack Overflow
stackoverflow.com › questions › 71647657 › powershell-functions-defined-in-profile
metadata - Powershell functions defined in profile - Stack Overflow
hi @Matias... that is one of the goals... i ineed to know from what profile the function came using the function name... this metadata should be available in the same form as when you do a (Get-Command -Name Update-IscsiTarget ).Module.Path ... Try `${function:GreatFunction1}.File this should give you the full path for wherever your function is coming from
🌐
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 - This example uses the syntax that defines the parameter with the help of Param within the function. It determines that a value for AppName has to be passed; otherwise, the user will be prompted to enter its value. The function also expects a value of type String. In addition to the Mandatory attribute, PowerShell offers a variety of attributes to validate the passed parameters.
🌐
Microsoft Learn
learn.microsoft.com › en-us › powershell › module › microsoft.powershell.core › about › about_functions_advanced_parameters
about_Functions_Advanced_Parameters - PowerShell | Microsoft Learn
January 24, 2025 - You can add parameters to the advanced functions that you write, and use parameter attributes and arguments to limit the parameter values that function users submit with the parameter. When you use the CmdletBinding attribute, PowerShell automatically adds the Common Parameters.
🌐
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.
🌐
Medium
thesmashy.medium.com › helpful-functions-for-your-powershell-profile-9fece679f4d6
Helpful Functions For Your PowerShell Profile | by mr.smashy | Medium
February 26, 2021 - It’s a valid question, so to determine if you do, open a PowerShell session and enter: ... If the response has values for all four values, especially CurrentUserCurrentHost, you have a profile.
🌐
EDUCBA
educba.com › home › data science › data science tutorials › powershell tutorial › powershell function parameters
PowerShell Function Parameters | Working | Examples
March 6, 2023 - PowerShell function parameters make function-rich by using attributes and arguments to restrict users to enter certain values. It adds a few checks and validations to avoid writing long codes for them, and they are easy to use.
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
tutorialpedia
tutorialpedia.org › blog › what-s-in-your-powershell-profile-ps1-file
PowerShell profile.ps1: What’s Inside? Essential Functions, Aliases & Startup Scripts You Need
Pro Tip: For ll, add parameters to mimic Unix ls -l: function ll { Get-ChildItem -Path $pwd -File -Force -ErrorAction SilentlyContinue | Format-Table Name, Length, LastWriteTime } Your profile can run scripts automatically when PowerShell starts.
🌐
SS64
ss64.com › ps › syntax-profile.html
Set the PowerShell startup $Profile user environment
The built-in aliases are 'sticky', unless they are removed from every session (by adding a Remove-Item command to $Profile) then they will re-appear the next time you start PowerShell. The Common Parameters such as -debug, -Verbose, -ErrorAction etc can also have their default set within the ...