Search

$PSBoundParameters + $PSDefaultParameterValues[Cmdlet] = bug by S.K. _

Active

2
0
Sign in
to vote
Type: Bug
ID: 775020
Opened: 12/22/2012 8:04:59 AM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
# CASE1: function
PS > function aaa ( [Parameter(ValueFromPipeline)]$aaa, $bbb, $ccc , $ddd ) { }
PS > $PSDefaultParameterValues['aaa:ddd'] = { $PSBoundParameters >> aaa.log }
PS > 1..5 | aaa -bbb BBB -ccc CCC
PS > cat .\aaa.log

Key                                 Value
---                                 -----
bbb                                 BBB
ccc                                 CCC
aaa                                 1

... 2,3,4 ...

Key                                 Value
---                                 -----
bbb                                 BBB
ccc                                 CCC
aaa                                 5


Parameters are reflected in $PSBoundParameters.



# CASE2: Cmdlet
PS > $PSDefaultParameterValues['Get-ChildItem:Force'] = { $PSBoundParameters >> bbb.log }

PS > $PSDefaultParameterValues['Get-ChildItem:Force'] = {
     "`n---`$args[0].BoundParameters---" >> bbb.log
     $args[0].BoundParameters >> bbb.log
     "`n+++`$PSBoundParameters+++" >> bbb.log
     $PSBoundParameters >> bbb.log
     }

PS > ls -path .\aaa.log -File -Verbose
PS > cat bbb.log

---$args[0].BoundParameters---
Path
Verbose

+++$PSBoundParameters+++

---$args[0].BoundParameters---
Path
Verbose
File

+++$PSBoundParameters+++

---$args[0].BoundParameters---
Path
Verbose
File

+++$PSBoundParameters+++


Parameters are not reflected in $PSBoundParameters.
Details (expand)
How often does this happen?
Always Happens

Have you seen this problem before in this product?

No, this is new to the most recent version
Reproduction Steps
 
Expected Results
 
File Attachments
0 attachments
Sign in to post a comment.
Sign in to post a workaround.