Reputation: 9579
I know how to use splatting to pass parameters to a cmdlet.
How would I write a cmdlet to "unsplat"? I want to get all the parameters passed to my function as a hashtable.
For example:
function Test-Unsplat
{
[cmdletbinding()]
param(
$ParamA,
$ParamB
)
# WHAT TO DO HERE TO GET @{ParamA = '...', ParamB = '...'}
}
Upvotes: 2
Views: 202
Reputation: 9579
I found the answer with
Get-Help about_Splatting
The answer I was looking for is $PSBoundParameters.
Upvotes: 1