checking which parameter selected

i have a script that has several parameters.
A user selects a parameter and gives it a value.
When parameter is selected a certain cmdlet is being called.
each parameter has different a action.

currently i’m using an IF statement for each parameter to check if it was selected.
is there a better way to check which parameter is selected?
also, i want a “default” cmdlet to take place when no parameter (they’re not mandatory) is selected, is there a nice way to check this too?

function get-selectedparams{





The following short post gives a quick explanation of $PSBoundParameters.

Thank you Daniel for the link.
this is basically what i did in my script.
I was just wondering if maybe there is a better way to work with the parameter selection besides using if statement for each one.

Apologies, I didn’t read your original post fully because I wanted to add context to Dan’s reply.

An alternative way to test for parameters is using parameter sets which would give you an idea for your question regarding defaults.

Here are some links as reference: