start/stop services from DOS prompt

are commands available for the above?

thanks
LVL 6
anushahannaAsked:
Who is Participating?
 
KenMcFConnect With a Mentor Commented:
You can use net start and net stop

net start SERVICE
net stop SERVICE

To restart
net stop SERVICE && net start SERVICE
0
 
nimda7Connect With a Mentor Commented:
   net stop <service_name>

    net start <service_name>
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
anushahannaAuthor Commented:
thanks - is stop and immediate restart ok, or better to give a pause?
0
 
KenMcFConnect With a Mentor Commented:
Using
net stop SERVICE && net start SERVICE
it will wait until the serivce is stopped and then continue with the start.
0
 
anushahannaAuthor Commented:
there is a display name and then a service name.. i assume i am to choose the second one?
0
 
c_a_n_o_nConnect With a Mentor Commented:
Another command that can be used is the SC command, it is extremely flexible beyond the stop and start service.

SC stop SERVICE
SC start SERVICE

http://support.microsoft.com/kb/251192
http://ss64.com/nt/sc.html
0
 
c_a_n_o_nCommented:
use the Service name
0
 
anushahannaAuthor Commented:
c_a_n_o_n, what benefit do you envision using SC over NET ?

can you combine both statements into one with SC, like with NET
0
 
KenMcFConnect With a Mentor Commented:
if you are looking for other options you can do this using powershell to

get-serivce w32time | Stop-service
get-serivce w32time | Start-service

(gwmi win32_service | where {$_.name -eq "w32time"}).startservice
(gwmi win32_service | where {$_.name -eq "w32time"}).stopservice

There are a lot of other options you can do here as well.

$b = gwmi win32_service | where {$_.name -eq "w32time"}

To find all the options for this
$b | Get-member


0
 
anushahannaAuthor Commented:
Thanks very much for the options available.
0
All Courses

From novice to tech pro — start learning today.