I'm writing a binary powershell module that will replace another command line tool that just outputs text.
I have a handful of commands that follow the powershell verb guide (eg. Add-MyModuleUser -UserName "My Username") but I would like to also have an overloaded command that takes the object responses of these and format them like the tool I'm replacing which accepts input in the following format:
myModule addUserName "My Username"
My instinct says to have a command called Invoke-MyModule with an alias to myModule, so I could call Invoke-MyModule addUserName "My Username" which would call Add-MyModuleUser and format that output with like the original tool.
Question: How can I get a powershell command to accept input like this?
Note: I was reading about ParameterSets which seem promising, I was thinking I could declare the parameter set to string, so the first word in the string sets the ParameterSet for the rest of the parameters that are entered.
Thanks!