Important alert: (current site time 7/15/2013 8:47:31 AM EDT)
 

winzip icon

_ Control the Windows Services; START / STOP SERVICES! and list all services on your computer VB.NET

Email
Submitted on: 3/30/2002 4:02:45 PM
By: Jon Barker  
Level: Intermediate
User Rating: By 18 Users
Compatibility: VB.NET
Views: 41013
(About the author)
 
     This code will list all windows services, running or not, and can start / stop them as you wish. This example doesnt use any service controls at all! The services are inputted into a listview control. Enjoy! (and vote if you think i did a good job :) tHe_cLeanER

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 14 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

3/31/2002 9:41:56 AMKevin Pirkl

Looks Cool! I would have taken the Stop, Start, Read and popped them into a Class for easier re-use though. BUT I love it. I needed something tohelp me with understanding services because I need to put SQL server on a timer to do a late start since my EMC drives dont come up till after SQL has started and Databases keep getting marked Suspect. This will help me.. Cool!!!

5 stars.

Kevin
(If this comment was disrespectful, please report it.)

 
3/31/2002 10:47:25 AMroswellevent

Great!
5 for me
(If this comment was disrespectful, please report it.)

 
4/2/2002 9:17:40 AMtHe_cLeanER

heh, thanx for the positive feedback guys... :) and roswell, have i gained a fan? ;)
(If this comment was disrespectful, please report it.)

 
5/26/2002 1:42:40 PMnhsxth

Comments from cDc's redbox.c!
(If this comment was disrespectful, please report it.)

 
9/20/2002 4:13:30 PM

Just wondering if you can tell me if an NT service in .NET can run in a single-threaded apartment model? I have an ActiveX component that is single-threaded that is not being instantiated in the service.

Thanks,
jliou@triteksol.com
(If this comment was disrespectful, please report it.)

 
9/20/2002 4:15:53 PM

Hi,

Just wondering if you can tell me if a windows nt service written in vb.net can run in a single-threaded apartment model? I have an activex component that is single-threaded but is not being instantiated when I try to run the service. Any light shed on this would be greatly appreciated.

Thanks,

Jen
(If this comment was disrespectful, please report it.)

 
10/8/2002 6:10:08 AM

Just what im looking for! Brilliant work man! 10 GLOBES FOR YOU! :o)
(If this comment was disrespectful, please report it.)

 
11/22/2002 12:19:35 PM

5 from me
(If this comment was disrespectful, please report it.)

 
4/3/2003 1:08:29 PM

Very good!
(If this comment was disrespectful, please report it.)

 
5/10/2004 9:55:37 AMDave Andrews

Good job - 5 globes

Meaningful comments instead of poetry would have been nice.


(If this comment was disrespectful, please report it.)

 
7/27/2004 9:14:09 PMBrad D. Harper

Great code easy to understand and build upon. Thank you.
(If this comment was disrespectful, please report it.)

 
9/2/2004 5:40:50 AM

The code is really excellent. May I get your photo? Please dont mind as a friend
(If this comment was disrespectful, please report it.)

 
9/2/2004 5:43:47 AM

Please send me your photo which you put on your desktop as a psc link.
(If this comment was disrespectful, please report it.)

 
9/15/2004 11:36:35 PMBalder

Great work! 5 globes!
But is there anyone who knows how to enable a disabled service?
(If this comment was disrespectful, please report it.)

 
10/7/2004 9:45:48 AMJim Wilson

I agree with Dave Andrews, except I wouldn't have called that poetry. More like ramblings. It had nothing to do with the code at all and it was something I really didn't want to read while I'm at work and trying to work on a problem while looking at sample code.
(If this comment was disrespectful, please report it.)

 
12/2/2004 10:53:32 PM

do you know how enable\disable a local service programatically?

it would be nice if you could encorporate a feature like that in your code. I really need to find an example on this.

thanks.
(If this comment was disrespectful, please report it.)

 
7/2/2006 11:58:50 AMSandy''s

thnx,
It is a gr8 tech. to so the windows services....
really

(If this comment was disrespectful, please report it.)

 
9/22/2006 2:48:16 AMMandar

To enable/disable windows service programmatically you need to tweak with registry. Use following C# code

RegistryKey ckey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\IISAdmin", true);
string str = ckey.GetValue("Start").ToString();
ckey.SetValue("Start", 2);

Change "IISAdmin" with your service name. Also while setting value following are the options :
2 - Automatic mode
3 - Manual Mode
4 - Disabled.

Thank you.
(If this comment was disrespectful, please report it.)

 
11/10/2006 11:19:34 AM

Nice code. The comments were interesting but not something to complain over, the code is pretty easy to follow. I'm sure it couldn't have inconvenienced you that much, Jim.

Anyhow, good work :) 5 globes.
(If this comment was disrespectful, please report it.)

 
12/6/2006 7:54:32 PM

"2)NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code."

Um. Since when have you been able to _run_ source code?

(If this comment was disrespectful, please report it.)

 
12/29/2006 4:40:46 AMkelvin

Greate
(If this comment was disrespectful, please report it.)

 
2/19/2008 2:19:38 PMJason Vetter

Please spare us the comments. You poluted the code with that garbage.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.