Don’t think you can put the parameter in a variable and call it.
You can put the input of the parameter in a variable.
I’m assuming this isn’t what you’re trying to do and there’s more to the script, because that variable and command isn’t necessary to put in a variable.
If you’re actually trying to do something more complex, you can put the info in a variable and call it like so.
$a = '*'
get-aduser -filter $a
So if you have a criteria for the filter, you can put that in a variable. But still have to define -filter parameter in the command.
particularly where it says this: In most cases, you invoke expressions using PowerShell’s call operator and achieve the same results. The call operator is a safer method.