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.
Related videos on Youtube
Author by
okigan
Updated on September 18, 2022Comments
-
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:
- The remote program shall be able to access a network share (read/write)!
- The output of the program shall be captured (back to controlling computer)
- Automat-able to run from a script (i.e. python)
I have looked at following:
- WMI -- can run a program but it cannot access network shares and output is not visible (fire and pray method?)
- WinRM -- supposedly can access network shares but setup is beyond complicated (seems to require not self-signed certificates and entring password, which fails C)
- PsExec -- cannot run executable from network path
Environment: all Win 7, can run as local admin
-
Dirk Eddelbuettel about 11 yearsSeriously, this is a hard problem which has been solved pretty well by ssh authentication. I'd use that solution.
-
Xymostech about 11 years+1 for ssh. Is there any reason you wouldn't want to use ssh, besides having to install it?
-
okigan about 11 yearsI 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 about 11 yearsah, yes, I forgot to mention i tried that -- it cannot access to the network, can it?
-
okigan about 11 yearsIntended to run executable itself from network: \\path.exe. This does not require copying when running even in Remote Desktop
-
Tobia about 11 yearsYour 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 about 11 yearsYes, 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 about 11 yearsTried 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 about 11 yearsThat'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.