Skip to content
Cannot bind argument to parameter '...'

Cannot bind argument to parameter '...'

DodaTech 3 min read

The “Cannot bind argument to parameter ‘…’” error means the value cannot be converted to the parameter type, or the pipeline input lacks the required property.

What It Means

PowerShell cmdlet parameters are strongly typed — each parameter expects a specific .NET type like String, Int32, DateTime, or IPAddress. When you pass a value that cannot be implicitly converted (e.g., a string like “hello” for a [int] parameter), PowerShell raises a binding error. The same happens when piping objects: if the cmdlet expects a property named Name but your object has FullName, the parameter cannot bind.

Why It Happens

  • You passed a string where a number is required: Get-Process -Id "abc".
  • You passed a string where a DateTime is required: Get-Date -Date "not-a-date".
  • Pipeline objects do not have the expected property name.
  • You are using the wrong parameter set — the parameter exists but not in the current combination.
  • The value is $null and the parameter does not accept nulls.
  • The value is an array but the parameter expects a single value.

How to Fix It

1. Check the expected parameter type

# See the parameter types
Get-Command Get-Process -Syntax
(Get-Command Get-Process).Parameters["Id"].ParameterType

2. Cast values to the correct type explicitly

# Bad — string where int is expected
Get-Process -Id "123"

# Good — explicit cast
Get-Process -Id [int]"123"

3. Specify the correct property name in the pipeline

# Create objects with the property names the cmdlet expects
$objects = [PSCustomObject]@{
    Name = "notepad"
    Id = 1234
}

$objects | Get-Process   # Works because 'Name' and 'Id' match parameters

4. Use Select-Object to rename properties before piping

Get-Service |
    Select-Object @{Name="Name"; Expression={$_.ServiceName}} |
    Get-Process

5. Check for $null values

$processName = $null
Get-Process -Name $processName   # Binding error

# Guard against null
if ($processName) {
    Get-Process -Name $processName
}

6. Use splatting for complex parameter sets

$params = @{
    ComputerName = "Server01"
    Credential = Get-Credential
    ErrorAction = "Stop"
}
Invoke-Command @params -ScriptBlock { Get-Service }
How do I find a cmdlet’s parameter types without running it?
Use (Get-Command CmdletName).Parameters.Values | Select-Object Name, ParameterType to list every parameter and its expected .NET type. For detailed help with examples, run Get-Help CmdletName -Detailed or Get-Help CmdletName -Parameter * to see parameter-specific documentation.
What does “Cannot bind parameter because parameter set is not specified” mean?
Some cmdlets have multiple parameter sets — mutually exclusive groups of parameters. For example, Get-Process can accept -Name or -Id but not both. When PowerShell cannot determine which set you intend, it throws this error. Provide only the parameters from one set, or check Get-Command -Syntax for all valid combinations.
Can I make a parameter accept pipeline input by property name?
Yes — if you are writing your own functions, decorate the parameter with ValueFromPipelineByPropertyName = $true. Then any object with a matching property name will bind automatically. This is how cmdlets like Get-Process and Get-Service accept pipeline input by name without custom property mapping.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro