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
mahmood66Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

käµfm³d 👽Commented:
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.
0
mahmood66Author Commented:
Dear kaufmed,

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

thanks
0
Easwaran ParamasivamCommented:
Follow the second method in the below given artilce.

http://motevich.blogspot.com/2007/11/execute-program-on-remote-computer.html
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

mahmood66Author Commented:
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
0
Easwaran ParamasivamCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
käµfm³d 👽Commented:
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

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.