
Untitled
By: a guest on
Jul 31st, 2012 | syntax:
None | size: 0.67 KB | hits: 13 | expires: Never
Outputting PSBound Parameters
foreach ($psbp in $PSBoundParameters)
{
$messageBody += $psbp | out-string + "`r`n"
}
foreach($psbp in $PSBoundParameters.GetEnumerator())
{
"Key={0} Value={1}" -f $psbp.Key,$psbp.Value
}
function Get-PSBoundParameters
{
[CmdletBinding()]
Param($param1,$param2,$param3)
foreach($psbp in $PSBoundParameters.GetEnumerator())
{
"Key={0} Value={1}" -f $psbp.Key,$psbp.Value
}
}
PS> Get-PSBoundParameters p1 p2 p3 | ft -a
Key=param1 Value=p1
Key=param2 Value=p2
Key=param3 Value=p3
function test
{
param($a, $b)
$psboundparameters.Values
$psboundparameters.Keys
}
test "Hello" "World"