views:

7381

answers:

4

I have a shared folder in a server and I need to remotely execute a command on some files. How do I do that?

What services need to be running on the server to make that work?

Some details: Only C# can be used. Nothing can be installed in the server.

+3  A: 

You could use SysInternal's PsExec.

0xA3
A: 

IMO, in your case you can try this:

  1. Map the shared folder to a drive or folder on your machine. (here's how)
  2. Access the mapped drive/folder as you normally would local files.

Nothing needs to be installed. No services need to be running except those that enable folder sharing.

If you can access the shared folder and maps it on your machine, most things should work just like local files, including command prompts and all explorer-enhancement tools.

This is different from using PsExec (or RDP-ing in) in that you do not need to have administrative rights and/or remote desktop/terminal services connection rights on the remote server, you just need to be able to access those shared folders.

Also make sure you have all the necessary security permissions to run whatever commands/tools you want to run on those shared folders as well.


If, however you wish the processing to be done on the target machine, then you can try PsExec as @divo and @recursive pointed out, something alongs:

PsExec \\yourServerName -u yourUserName cmd.exe

Which will brings gives you a command prompt at the remote machine. And from there you can execute whatever you want.

I am not sure but I think you need either the Server (lanmanserver) or the Terminal Services (TermService) service to be running (which should have already be running).

chakrit
If you run executables via a shared folder, they don't run on the sharing server. They run on the browsing client.
recursive
If *some* files is not a lot of files, then I don't think that is a problem.
chakrit
A: 

I use the little utility which comes with PureMPI.net called execcmd.exe. Its syntax is as follows:

execcmd \\yourremoteserver <your command here>

Doesn't get any simpler than this :)

Dmitri Nesteruk
A: 
ZokiManas