To better integrate my Windows DevOps into Emacs Org-mode, I'd like to use my local emacs as an IDE for a remote Powershell.
SSH was easily setup, from Linux shell ssh
I can successfully login to a powershell
powershell shell as a domain user, and run commands, without password, using keys. Non-ASCII characters like 'é' work, and TAB works as usual in cmd
and powershell
.
I routinely run code blocks on Linux systems via SSH, so I tried:
#+NAME: PSH-Test #+HEADER: :dir "/ssh:MyWinPC:~/" #+BEGIN_SRC shell ipconfig #+END_SRC
When I run the above, I get queried for my remote password, and then I get a message
Tramp: Found remote shell prompt on MyWinPC
Emacs then hangs until I press C-g.
In *scratch*
I then executed (setq tramp-verbose 10)
, and retried. In the debug output buffer I could see my remote prompt, so login seems to have worked, and there was a message indicating, that /bin/sh
could not be loaded. So I am assuming this to be the/a problem.
Do I need winexe
, If i can successfully ssh
?
Using sh
, shell
, or powershell
as code block language makes no difference.
I installed a package for powershell from the package manager.
So, How do I correctly call/execute PowerShell/CMD commands/scripts from linux emacs org-mode code blocks on remote Windows 7+ Hosts via SSH?
Note: In the meantime I use the workaround of wrapping all windows devops scripts into a linux shell block, that does ssh
as first step, but that feels ugly.
#+BEGIN_SRC sh
. Take care you need to(require 'ob-shell)
in your configuration, if your org version is >8.2SRC
block stalled creating the temporary script on the windows filesystem. Also I wonder if adding:session session-name
header to yourSRC
block would provide additional debug output in a buffer named session-name.