Home Dashboard Directory Help
Search

Powershell shouldn't treat -switch: $false as having the parameter set specified by Derp McDerp


Status: 

Active


1
0
Sign in
to vote
Type: Bug
ID: 808702
Opened: 11/15/2013 11:46:05 AM
Access Restriction: Public
1
Workaround(s)
view
0
User(s) can reproduce this bug

Description

If I do

Foo -SomeSwitch: $false

Powershell treats it as if whatever parameter set name SomeSwitch had is the one specified instead of ignoring it. This makes it a pain to call helper functions by passing arguments as is without verbose $PSBoundParameter trickery/
Details
Sign in to post a comment.
Sign in to post a workaround.
Posted by Oisín Grehan on 11/17/2013 at 6:20 PM
You don't need much trickery for passing on bound parameters - use the splat @ operator:

& wrappedfunction @psboundparameters