1

I'm trying to launch a PowerShell on a remote Windows system using tramp. So far all I've been able to do is start a PowerShell inside Emacs on the local (Windows) machine. What is the connection incantation to, from within Emacs, launch a PowerShell on a remote Windows machine? I know how to use tramp to connect to a *nix system using ssh in the connection string, but I don't know what the syntax is for connecting to a Windows system (using tramp). Here is my elisp so far. What do I need to add to connect to a remote machine?

(defun remote-powershell (machine)
  "Run PowerShell on MACHINE."
  (interactive "smachine: ")
  (let ((explicit-shell-file-name "powershell")
    (explicit-powershell-args '("-file" "-")))
    (call-interactively 'shell)))
1

The Tramp manual describes how to access a remote Windows machine. It uses Samba's smbclient program. A remote path looks like this: /smb:user%DOMAIN@machine:/share/path/to/file. The %DOMAIN part is optional. share is the name of a share on that machine.

However, this is only the first part. Samba does not support to run remote processes on a Windows machine. Years ago, I did integrate the call of winexe into Tramp for that purpose, and indeed, I could call a remote powershell from my local Emacs, running on GNU/Linux.

I haven't followed this last time, but there are messages that winexe cannot be compiled any longer with recent Samba. And I don't know of a replacement.

Anyway, you might study the Tramp manual, which describes what did run in the past:

(info "(tramp) Quick Start Guide: smb method")
(info "(tramp) External methods")
(info "(tramp) Remote processes")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.