• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 234
  • Last Modified:

starting a Windows service remotely

Is there any way I can get a C# app to start a Windows service on another machine over the network?
0
abcast
Asked:
abcast
1 Solution
 
boethius78Commented:
Try this:

ServiceController controller = new ServiceController( "ServiceName", "MachineName" );
if( controller.Status == ServiceControllerStatus.Stopped )
    controller.Start();

I've only ever used ServiceController on the local machine though.  I guess as long as you have permission to control services on the other machine, it ought to work OK.  You'll need to add a reference to System.ServiceProcess.dll.

Hope this helps.
0
 
abcastAuthor Commented:
Thanks.  I will cache this info for later use.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

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