Skip to content

Runnable Scripts passes in $args for pwsh scripts causing errors if the script uses params #755

@a-m-brewer

Description

@a-m-brewer

I have created a pwsh script with params e.g.

param(
    [Parameter(Mandatory=$false)]
    [string]$InterfaceName = "Switch Name",

    [Parameter(Mandatory=$false)]
    [string]$SSHConfigName = "config_example",

    [Parameter()]
    [Switch]$Backup
)

I have given it the following execution types

Image

I know that "Runnable scripts" have no way to enter arguments so in my script I have left fallbacks with my most common configuration. With the idea that if I need something more advanced I will start a shell session and run the script as a "Shell session script"

However, when I run the script I get the following

Image

Is this a bug or is there a better way of handling this scenario?

Also I know this is more of a feature request, but would it be possible to have some sort of way to define common argument configurations so you could select "Runnable A" > "Argument Set B".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions