start/stop services from DOS prompt

are commands available for the above?

thanks
LVL 6
anushahannaAsked:
Who is Participating?
 
KenMcFCommented:
You can use net start and net stop

net start SERVICE
net stop SERVICE

To restart
net stop SERVICE && net start SERVICE
0
 
nimda7Commented:
   net stop <service_name>

    net start <service_name>
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  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
 
KenMcFCommented:
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_nCommented:
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
 
KenMcFCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.