Running a program on remote computer from a network share

15,479

I would recommend PowerShell remoting. But answer to question how? depends very much on environment (domain/ workgroup) and your rights (on server/ within domain).

That's one command in AD environment:

Set-ADComputer -TrustedForDelegation $true -Identity <your target server>

And later:

Invoke-Command -ComputerName <target server> -ScriptBlock { your command }

... but that will not work in workgroup environment, so I guess you need to be more specific here.

Share:
15,479

Related videos on Youtube

okigan
Author by

okigan

Updated on September 18, 2022

Comments

  • okigan
    okigan over 1 year

    Well going all in: assigning all my 72 point as bounty to this question!

    How to run a command line program on remote Windows computers with out installing additional software (aka ssh). All recommendations on the web/stackoverflow fail following basic needs:

    1. The remote program shall be able to access a network share (read/write)!
    2. The output of the program shall be captured (back to controlling computer)
    3. Automat-able to run from a script (i.e. python)

    I have looked at following:

    1. WMI -- can run a program but it cannot access network shares and output is not visible (fire and pray method?)
    2. WinRM -- supposedly can access network shares but setup is beyond complicated (seems to require not self-signed certificates and entring password, which fails C)
    3. PsExec -- cannot run executable from network path

    Environment: all Win 7, can run as local admin

    • Dirk Eddelbuettel
      Dirk Eddelbuettel about 11 years
      Seriously, this is a hard problem which has been solved pretty well by ssh authentication. I'd use that solution.
    • Xymostech
      Xymostech about 11 years
      +1 for ssh. Is there any reason you wouldn't want to use ssh, besides having to install it?
    • okigan
      okigan about 11 years
      I wish this was a linux question -- it's really mesmerizing that Windows makes it so convoluted. A. requires install, B. from what I've seen all operations run under services user account vs running in context of the calling user (security issue, no?)
  • okigan
    okigan about 11 years
    ah, yes, I forgot to mention i tried that -- it cannot access to the network, can it?
  • okigan
    okigan about 11 years
    Intended to run executable itself from network: \\path.exe. This does not require copying when running even in Remote Desktop
  • Tobia
    Tobia about 11 years
    Your original question asks "The remote program shall be able to access a network share", not "The remote program shall reside on a network share".
  • okigan
    okigan about 11 years
    Yes, have tried that -- does not work: PsExec comes back with "The system cannot find the path specified." I have double checked the path, but running a local program ie. 'ipconfig' works...
  • okigan
    okigan about 11 years
    Tried calling "Set-ADComputer", per error message it needs to be called on main Active Directory system and by domain admin -- which is outside of my rights of Local Admin
  • BartekB
    BartekB about 11 years
    That's why answer to question at the beginning of my answer is crucial if you want to get answer that's applicable for your environment/ account/ rights.