Skip to content

Conversation

@willemm
Copy link

@willemm willemm commented Jun 6, 2022

New directcommand.go with object that sends commands directly to the remote.
Noprofile and consolemode_stdin off, so remote powershell doesn't think it's interactive

This can be used to run a shell on the remote side, and then repeatedly send commands to that shell and receive their output.

I use this (in https://github.com/willemm/cluster-api-provider-scvmm) to open a powershell remotely and then run a number of cmdlets on it, which is much cleaner and faster than sending each statement as a commandline-option to powershell.exe

@masterzen
Copy link
Owner

Your PR proposes an incompatible change with respect to WINRS_NOPROFILE and WINRS_CONSOLEMODE_STDIN.
I would favor those to be injected into the request instead of being changed for every command.
You could for instance modify your direct command system to make sure those options are set how they should.

Would you mind adding some documentation about the direct command system in a section of the README?

@willemm
Copy link
Author

willemm commented Jun 11, 2022

Good point. I'll look into how to set those dynamically, and write up some documentation.

@willemm willemm force-pushed the feature/directcommand branch from 0dae34e to 1d7a916 Compare June 11, 2022 19:33
@willemm
Copy link
Author

willemm commented Jun 13, 2022

I wasn't able to put it in the direct-command system because that only applies after a shell has been created, and the options in question are applied when connecting/creating the shell. So I decided to just add an options field to the parameters where these options (along with the other two, i.e. codepage and skip_cmd) can be set.

I've also documented this in the readme, along with the workings of directcommand. I hope my descriptions are clear enough :)

@willemm willemm force-pushed the feature/directcommand branch from 1d7a916 to 397f988 Compare March 8, 2024 15:24
willemm added 3 commits March 8, 2024 16:31
New directcommand.go which sends commands directly to the remote.
Noprofile and consolemode_stdin off, so remote powershell doesn't think it's interactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants