Solved

starting a Windows service remotely

Posted on 2006-06-12
2
223 Views
Last Modified: 2010-04-16
Is there any way I can get a C# app to start a Windows service on another machine over the network?
0
Comment
Question by:abcast
2 Comments
 
LVL 3

Accepted Solution

by:
boethius78 earned 500 total points
ID: 16999824
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
 

Author Comment

by:abcast
ID: 17050963
Thanks.  I will cache this info for later use.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now