By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,417 Members | 1,088 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,417 IT Pros & Developers. It's quick & easy.

Controlling services

P: n/a
Hello,

I'm trying to speed up windows start a bit. Therefore I want to start
some services at a later point of time and some only if I run the
application which needs the services.
The first point is no problem, "net start" allows manual start of a
service. The tricky one is the second. Is there any .net class that
allows controling the services? I need to check if a specific service
(identified by name) is running and to start it, if it is not running.
Thanks in advance,

Stefan

--
___________________________________www.VBTricks.de .vu
the free resource for Visual Basic, Gambas and Pascal
components, tips & complete projects

www: http://www.VBTricks.de.vu
mail: vbtricks <at> gmx <dot> net
__________________________________________________ ___
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

The servicecontroller class does what you want.

Dim s As System.ServiceProcess.ServiceController

For Each s In System.ServiceProcess.ServiceController.GetService s
If s.ServiceName = "MSSQLSERVER" Then
If s.Status = ServiceProcess.ServiceControllerStatus.Stopped
Then s.Start()
End If
's.Stop to stop
's.Start to start
's.Pause to pause
Next
Ken
--------------------
"VBTricks.de.vu Webmaster" <no****@thisserverdoesntexist.com> wrote in
message news:%2***************@tk2msftngp13.phx.gbl...
Hello,

I'm trying to speed up windows start a bit. Therefore I want to start some
services at a later point of time and some only if I run the application
which needs the services.
The first point is no problem, "net start" allows manual start of a
service. The tricky one is the second. Is there any .net class that allows
controling the services? I need to check if a specific service (identified
by name) is running and to start it, if it is not running.
Thanks in advance,

Stefan

--
___________________________________www.VBTricks.de .vu
the free resource for Visual Basic, Gambas and Pascal
components, tips & complete projects

www: http://www.VBTricks.de.vu
mail: vbtricks <at> gmx <dot> net
__________________________________________________ ___

Nov 21 '05 #2

P: n/a
"VBTricks.de.vu Webmaster" <no****@thisserverdoesntexist.com> schrieb:
The first point is no problem, "net start" allows manual start of a
service. The tricky one is the second. Is there any .net class that
allows controling the services? I need to check if a specific service
(identified by name) is running and to start it, if it is not running.


Take a look at the 'ServiceController' class.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.