PowerShell Genie

Parameter binding fails

Incident 2 min read Troubleshooting walkthrough

Documentation: Microsoft Learn

Work the problem

The parameter is present, but incompatible

Fictional case: A command works with either of two parameter combinations. Combining both produces a parameter-set error.

How should you narrow it down?

Reasoning notebook

Record the evidence that supports your answer and the check you would run next. Your notes stay in this browser — nothing is uploaded.

Why it happens

PowerShell decides which parameter set applies before executing anything, and a combination spanning two mutually exclusive sets is unresolvable however sensible it reads. Type conversion is the other frequent failure, where a value is handed to a parameter expecting a different type and no coercion exists. Passing an array where a single item is expected fails the same way.

Check this first

1PS> Get-Command $Command -Syntax; Get-Help $Command -Full

What to look for

Parameters can exist individually but not belong to the same set. Start with a valid minimal call and add arguments deliberately.

Working through it

  1. Run Get-Command $Command -Syntax and find which single set contains every parameter you supplied.
  2. Read the parameter's declared type in Get-Help $Command -Full and compare it against what the variable holds.
  3. Check the variable with GetType() rather than trusting the way it prints.
  4. Remove parameters one at a time until binding succeeds, which identifies the conflicting pair.
  5. Cast the value explicitly, or wrap a single item in @() when the parameter expects a collection.

Avoiding it next time

Verify the repair: Confirm the intended minimal call binds, then reintroduce optional parameters one at a time.

Primary documentation

Get-Help reference · Get-Command reference

Genie guideParameter binding fails

Start with the symptom, then inspect the checks and evidence. These are investigation steps; more than one cause may fit.