473,320 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

handling services from C#

SR
Hi all I am able to get the list of services from C#
using System.ServiceProcess.ServiceController ->
GetServices() method. However, I don't find any C# method
that will change the StartMode of any service. I
currently know of changing the StartMode programmatically
by going to
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Servic es\AnySe
rviceName key. Is there any other recommended way? Please
let me know. Thanks for all your help.
Nov 16 '05 #1
2 1564
SR,

I would use the WMI Win32_Service class for this. Once you have that,
you can make a call to the ChangeStartMode method on that class to set the
start mode.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"SR" <an*******@discussions.microsoft.com> wrote in message
news:35****************************@phx.gbl...
Hi all I am able to get the list of services from C#
using System.ServiceProcess.ServiceController ->
GetServices() method. However, I don't find any C# method
that will change the StartMode of any service. I
currently know of changing the StartMode programmatically
by going to
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Servic es\AnySe
rviceName key. Is there any other recommended way? Please
let me know. Thanks for all your help.

Nov 16 '05 #2
How Could I get Services From other Machines on same Domain using
Win32_Service?

"Nicholas Paldino [.NET/C# MVP]" wrote:
SR,

I would use the WMI Win32_Service class for this. Once you have that,
you can make a call to the ChangeStartMode method on that class to set the
start mode.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"SR" <an*******@discussions.microsoft.com> wrote in message
news:35****************************@phx.gbl...
Hi all I am able to get the list of services from C#
using System.ServiceProcess.ServiceController ->
GetServices() method. However, I don't find any C# method
that will change the StartMode of any service. I
currently know of changing the StartMode programmatically
by going to
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Servic es\AnySe
rviceName key. Is there any other recommended way? Please
let me know. Thanks for all your help.


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ralph A. Moeritz | last post by:
Hello, I'd like to implement an exception handling mechanism in my C programs. Up to now I have been using a local error handling scheme where errors are handled (when appropriate) in the...
4
by: m96 | last post by:
hi, i'm trying to make a query to a ldap server (version v2 or v3 doen't matter) with c#. the query works just fine but the problem is that i can't read the custom attributes/fields, since .net...
1
by: Noor | last post by:
Hi all, I am trying to catch all types of exceptions from a app regardless of whether it is in debugger mode( VS development environment) or run the.exe file outside the IDE. My App...
1
by: Sherif ElMetainy | last post by:
Hello I have an application with several web services. I want to be able to log all exception are thrown by any web method. Since the web services handler catches and swallows all exceptions,...
6
by: - Steve - | last post by:
I'm using Forms Based Authentication. I've written my code so that when a user does something but has timed out, it gracefully logs them out and asks them to log back on. I do this with . . ...
1
by: michaeltorus | last post by:
Hi I'm currently designing a new web application in .Net. I've pretty covered everything, apart from error handling. There seems to be a few different way to do this, but something I've read...
2
by: Adrian Burka | last post by:
HELP! I have written a web service, and a program in C# using Microsoft Visual C#.NET to interact with the web service. Exception handling isn't working in my application, though. One function...
3
by: vijay.db | last post by:
Hi Group, Running DB2 V8.2 Fxpack 9 in AIX 5.2, I get the following error frequently and my instance is stopped...collected some info like: the signal received is 11 which is SEGMENTATION...
0
by: =?Utf-8?B?TVA=?= | last post by:
I hosted my WCF service in a Console App. the service is tagged to run as a singleton , The service implements following two methods One that throws exception public void ThrowException() {...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.