[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 341
  • Last Modified:

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
0
mahmood66
Asked:
mahmood66
  • 3
  • 2
  • 2
1 Solution
 
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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
 
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

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now