script-server icon indicating copy to clipboard operation
script-server copied to clipboard

Powershell issue using multilist

Open billybenson opened this issue 3 years ago • 3 comments

Hi Bugy,

Thanks again for providing a great script server.

I wonder if you can help with Windows server / Powershell setup.

We are using multilist parameter. How can we run a powershell cmd on each returned parameter? How can the powershell script drop down to the third multilist parameter?

Thanks in advance sir.

billybenson avatar Nov 14 '21 14:11 billybenson

Hi @billybenson sorry for the late reply.

Do you want to run a script multiple times? Or just pass the parameters it like my_script.ps1 value1 value2 value3 ?

bugy avatar Nov 17 '21 09:11 bugy

Hi - pass the parameters like you have mentioned above.

However, I would want to run a PS command in my_script.ps1 for value1 and value2 and value3.

Thanks.

billybenson avatar Nov 18 '21 15:11 billybenson

Hi @billybenson to pass the values like this, please use this configuration https://github.com/bugy/script-server/wiki/Script-config#multiple_arguments (set to true). Or if you are using dev build, use multiselect_argument_type

Regarding using those arguments and passing to another command. Unfortunately I don't know powershell at all and cannot be of a huge help here. However, I found this: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_Automatic_Variables?view=powershell-7.2#args

I.e. you can run a PS command with PS_command $args syntax

bugy avatar Nov 18 '21 15:11 bugy