-
Notifications
You must be signed in to change notification settings - Fork 510
Pass parameters to PowerShell.exe (specifically NonInteractive) #1470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Technically we already do pass We should definitely look into implementing a host that mirrors the default |
Related to the comment from @SeeminglyScience, I've got a bunch of PowerShell scripts that are typically executed by an automation platform with "-noninteractive". These scripts rely on some files containing secure-string credentials when running automatically, but I've just been investigating ways to allow them to prompt for credentials when run interactively from the command-line. Rightly or wrongly, I'm checking for the presence of "-noninteractive" on the command-line, and this works well from a standalone PowerShell instance. Inside VSCode, however, the script thinks its being run on the automation platform and so doesn't prompt for creds. I'll find a work-around for now, but "a host that mirrors the default |
Rather than check the command line parameters, I would check Generally though, I'm not sure how we would best emulate non-interactive startup, because it's a startup option -- there's no big switch inside the runtime to turn it on and off. I suspect that perfecting attach-to-process debugging is going to be the best option here |
I've often wished there was a public property for this :/ Even if you're willing to use reflection, this is a bigger pain than usual to get to because it's not on
The cheapest way imo would be to add a property to I'd be interested to hear some specifics about use cases though. I'm not sure I understand the value. Note that what I'm proposing wouldn't really emulate it in a way that would solve your problem @gmckeown. I think it's safe to say that there is currently no reliable or supported way of "detecting" non-interactive and best practices would recommend against attempting to account for it. |
@rjmholt @SeeminglyScience Thanks for the insight! |
PowerShell.exe
supports various command-line flags. It would be beneficial to allow control over these arguments. Specifically, I want to runpowershell.exe -NonInteractive
. This is especially useful whenpowershell.debugging.createTemporaryIntegratedConsole
is set to true so you get an isolated run with the exact environment you want.I tried using the
args
setting inlaunch.json
but that seems to pass parameters directly to my script, afterpowershell.exe
has already been loaded (with parameters I have no control over).The text was updated successfully, but these errors were encountered: