Consider such function:
function Test($foo, $bar)
{
...
}
We can call it:
Test -foo $null
Test
How can I know when the -foo was omitted, and when it was $null?
If you are using Powershell V2 or later, you can use the $PSBoundParameters variable which is a dictionary that lists all bound parameters at current scope.
See this blog post that discusses it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With