I wrote a powershell module in C # that has a bunch of cmdlets like
Add VM
Cmdlets access the API and return data.
but for uniformity with the ssh CLI of the product, I wrote a newtask function that takes "addvm" as an argument and $ args.
eg
newtask addvm -id 12345
Then I call Add-VM and pass $ args as a string like
Invoke-Expression Add-VM $argstr
The problem is that Add-VM throws an error that it cannot find the positional parameter that takes the argument System.Object []
Cannot find positional parameter that takes argument 'System.Object []'
While I could easily add "addvm" to the "Add-VM", I'm trying to maintain consistency with the ssh CLI so that new users can quickly start using this module.
I decided that sending a string like '-id 12345' would be sufficient, but it is not. Does pscmdlet expect anything else?
Thanks in advance.
source share