Alaska Software Inc. - Stop and Restart a service.
Username: Password:
AuthorTopic: Stop and Restart a service.
César Calvo Stop and Restart a service.
on Sun, 23 Jun 2024 20:05:47 +0200
Hello dear frineds,
Would anyone know how to stop a service knowing the name of that service 
and later restart it?
I am trying with TASKKLIST but it says a message saying access denied.
Regards.
César.
Andreas Gehrs-Pahl
Re: Stop and Restart a service.
on Sun, 30 Jun 2024 03:13:45 -0400
César,

>Would anyone know how to stop a service knowing the name of that service 
>and later restart it?

Sure, there are many ways.

>I am trying with TASKKLIST but it says a message saying access denied.

But all those ways require you to have admin rights!

1) The simplest way is the net command. On the command prompt (with Admin 
   rights), type:

   net stop ServiceName
and
   net start ServiceName

2) With the console Service Controller program. On the command prompt (with 
   Admin rights), type:

   sc stop ServiceName
and
   sc start ServiceName

3) With the Services Control Manager GUI snap-in for the MMC (Microsoft 
   Management Console) -- start it on a command prompt (with Admin rights), 
   using:

   Services.msc

   This will let you list and manage, all the Services.

4) Programmatically with Xbase++ -- using the ServiceController() and 
   ServiceApp() classes:

   For Details take a look at the Xbase++ docs:
   https://doc.alaska-software.com/content/cls_xppcref_servicecontroller.cxp
   https://doc.alaska-software.com/content/cls_xppcref_serviceapp.cxp

   Again, your application will need to have admin rights to do anything 
   besides listing the services.

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[L]:   https://www.LinkedIn.com/in/AndreasGehrsPahl
[F]:   https://www.FaceBook.com/AbsoluteSoftwareLLC