Starting and Stopping Services

rmatthew

Centurion
Joined
Dec 30, 2002
Messages
115
Location
Texas
I need to start / stop a specific service from a program. Is there a way to accomplish this in Visual Basic.NET?
 
Hi rmatthew,

have you a Solution for you Problem starting and stopping services ? I have the same Problem. I wrote a Windows Service, but i need a way to start und stop this service with a VB Programm.
 
Yes -

Dim serv As New System.ServiceProcess.ServiceController("[SERVICE NAME AS STRING]")

'to Start
serv.Start()

'to Stop
serv.Stop()
 
this is what I used

Dim sc As New System.ServiceProcess.ServiceController("Service Name")
sc.Start() 'Will start it (permissions required)
 
Back
Top