locked
Error on Process.Start() trying to execute exe on remote server. RRS feed

  • Question

  • I get an InvalidOperationException on Process.Start call to execute an exe on a remote server...

    If I replace my exe with notepad.exe it works fine, but it loads it locally, not on the remote server. I appreciate any assistance. Thanks.

    var p1 = new Process

    ();

    p1.StartInfo =

    new ProcessStartInfo("RunBatchExe.exe"

    );

    p1.StartInfo.WorkingDirectory = @"\\int-tst1\c$\Projects\CMDFiles";

    p1.Start();

    p1.WaitForExit();

    Wednesday, June 22, 2011 1:29 PM

Answers

  • You can't use Process to start a remote process (if that is what you meant).  You can use Process to retrieve the list of remote processes.

    The working directory must be a local path because the EXE is running locally.  Working directory != exe directory.  By default the working directory = exe directory but an app can change that many times throughout the life of the process.  

    To run an EXE that happens to reside on a network share you must specify the full path to the EXE.  Then, depending upon security, the process will run locally but in the Intranet zone so permissions are generally more strict.

    Michael Taylor -6/22/2011
    http://msmvps.com/blogs/p3net

    Wednesday, June 22, 2011 1:36 PM
  • read this

    http://msdn.microsoft.com/en-us/library/Aa389769

     Process using for local applications, running an exe on remote computer is something different.

    check "start applications on remote computers"

     


    Please mark this as answer or vote as helpful if it solved your problem. thank you
    Wednesday, June 22, 2011 1:37 PM
  • To execute any process on a remote machine you need appropriate permission on the machine.

    if you have so then you can use WMI to do that....

    http://www.codeproject.com/KB/cs/Remote_Process_using_WMI_.aspx

    this should help you get started...

    good luck.


    Regards, Krishnakant This answers, please mark as answered, if this helps please mark as helpful.
    Friday, June 24, 2011 5:54 AM

All replies

  • You can't use Process to start a remote process (if that is what you meant).  You can use Process to retrieve the list of remote processes.

    The working directory must be a local path because the EXE is running locally.  Working directory != exe directory.  By default the working directory = exe directory but an app can change that many times throughout the life of the process.  

    To run an EXE that happens to reside on a network share you must specify the full path to the EXE.  Then, depending upon security, the process will run locally but in the Intranet zone so permissions are generally more strict.

    Michael Taylor -6/22/2011
    http://msmvps.com/blogs/p3net

    Wednesday, June 22, 2011 1:36 PM
  • read this

    http://msdn.microsoft.com/en-us/library/Aa389769

     Process using for local applications, running an exe on remote computer is something different.

    check "start applications on remote computers"

     


    Please mark this as answer or vote as helpful if it solved your problem. thank you
    Wednesday, June 22, 2011 1:37 PM
  • Hi,

    Is any progress made?
    We are looking forward to hearing from you.
    Leo Liu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, June 24, 2011 3:32 AM
  • To execute any process on a remote machine you need appropriate permission on the machine.

    if you have so then you can use WMI to do that....

    http://www.codeproject.com/KB/cs/Remote_Process_using_WMI_.aspx

    this should help you get started...

    good luck.


    Regards, Krishnakant This answers, please mark as answered, if this helps please mark as helpful.
    Friday, June 24, 2011 5:54 AM