?
Solved

starting a Windows service remotely

Posted on 2006-06-12
2
Medium Priority
?
229 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
boethius78 earned 2000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

752 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