Link to home
Start Free TrialLog in
Avatar of mahmood66
mahmood66Flag for United Arab Emirates

asked on

Running exe(Application) from another machine via windows service

Dear Experts,

        i need to know the way how i can run an exe(application) which is located in another machine(Server) via windows Service by using VS2008 C# or VB.net

Note:
        service should run in both XP and Windows 7 also

kindly suggest me the code.

thanks
Avatar of kaufmed
kaufmed
Flag of United States of America image

You could use PSExcec from SysInternals. Just make sure to either pass the credentials of an account which exists on the remote machine, or run your service using an account that exists on both machines.
Avatar of mahmood66

ASKER

Dear kaufmed,

Can you give me the Example code in C# how i can use this "PSExec"

thanks
Dear Easwaran,

Thanks for your suggestion. couldn't able to use that code which you suggested.
Can you give me example code in C# ?
tell me which namespace and class i need to import to use " Win32_Process Class" & "Win32_ScheduledJob Class"


Note:
             my application should interact with client machine's  Desktop where my service runs.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Easwaran Paramasivam
Easwaran Paramasivam
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Can you give me the Example code in C# how i can use this "PSExec"
using System.Diagnostics;

namespace _27387473
{
    class Program
    {
        static void Main(string[] args)
        {
            Process.Start("psexec.exe", "\\remoteserver -u remoteusername -p remotepassword app_to_run.exe app_args1 app_args2");
        }
    }
}

Open in new window