- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 4
Description
This is a great tool and my team uses it heavily for local development. Thank you!!
We are hitting the following issue which has been very challenging to work around. We end up with many scripts to call the same PowerShell script with different parameters. Instead, we would prefer to use the -- and pass parameters to the underlying PowerShell script that way, if this was fixed. Here is the issue:
If we run .\run-script.exe get-test-account -- -Environment PROD, we the get this error:
Get-TestAccount.ps1: A positional parameter cannot be found that accepts argument '-Environment'.
We would hope to get this instead:
This is Get-TestAccount.ps1: AnotherParam = , Environment = PROD, Alias = testuser, AsPlainText = True, args =
Example PowerShell script:
#Requires -Version 7.0
[CmdletBinding(DefaultParameterSetName = 'Alias')]
param (
    [string] $AnotherParam,
    [ValidateSet("PPE", "PROD")]
    [string] $Environment = "PPE",
    [ValidateNotNullOrEmpty()]
    [Parameter(Position = 0)]
    [string] $Alias,
    [switch] $AsPlainText
)
Write-Host "This is Get-TestAccount.ps1: AnotherParam = $AnotherParam, Environment = $Environment, Alias = $Alias, AsPlainText = $AsPlainText, args = $args"Example global.json to invoke the script:
{
  "scriptShell": "pwsh",
  "scripts": {
    "get-test-account": "./Get-TestAccount.ps1 -AsPlainText -Alias testuser"
  }
}