Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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