Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Services start/stop

Posted on 2006-03-22
17
Medium Priority
?
376 Views
Last Modified: 2012-08-13
I have 10 services that run on a remote server and I wanted to know how I can automate the process of stoping them. right now I have to go into services and shut them down/start them one by one. How can I  do it with one click?
0
Comment
Question by:cdb424ttm
  • 6
  • 6
  • 4
  • +1
17 Comments
 
LVL 6

Expert Comment

by:PreachDotNet
ID: 16255978
You can write a batch file to accomplish this

http://www.tech-recipes.com/batch_file_programming_tips235.html
0
 
LVL 6

Expert Comment

by:liviutudor
ID: 16256241
use "net stop" and "net start" command -- type net start /? or net stop /? for details.
0
 
LVL 7

Accepted Solution

by:
CGretski earned 2000 total points
ID: 16256348
you can also you the command:

sc \\servername stop servicename

in a batch file which would allow you to stop them remotely

note that servicename would be it's short service name not it's display name ( both are shown in each service's properties in services.msc)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:cdb424ttm
ID: 16257330
that is what I'm looking for thanks All
0
 

Author Comment

by:cdb424ttm
ID: 16260323
sc \\sfmnntgso4 stop cdr-printengine  that did not work, CGretski
0
 
LVL 7

Expert Comment

by:CGretski
ID: 16260396
what error did it give?
0
 

Author Comment

by:cdb424ttm
ID: 16260411
nothing I jusst look at the services and it was still running
0
 
LVL 7

Expert Comment

by:CGretski
ID: 16260452
try issuing the sc command from the command line - and paste what it says -- should be something along the lines of :

C:\Documents and Settings\gerac>sc \\ourservername stop w32time

SERVICE_NAME: w32time
        TYPE               : 20  WIN32_SHARE_PROCESS
        STATE              : 3  STOP_PENDING
                                (NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x6
        WAIT_HINT          : 0x3e8

(used the windows time service in this example)

then if you run:
C:\Documents and Settings\gerac>sc \\ourservername query w32time

SERVICE_NAME: w32time
        TYPE               : 20  WIN32_SHARE_PROCESS
        STATE              : 1  STOPPED
                                (NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

does it say anything similar?
0
 

Author Comment

by:cdb424ttm
ID: 16260496
[SC] openscmanger failed 1722
the rpc server is unavailable
0
 
LVL 7

Expert Comment

by:CGretski
ID: 16260507
that suggests either the servername is wrong, or it's behind some firewall/proxy that's filtering RPC
0
 

Author Comment

by:cdb424ttm
ID: 16260570
so I need to do this on there machine?

0
 
LVL 7

Expert Comment

by:CGretski
ID: 16260587
can be on any machine, on the same network ..  and it would need to run under an account that has admin access to the other machine
0
 
LVL 6

Expert Comment

by:PreachDotNet
ID: 16266741
Write the batch file, put it on the remote machine and then access it as //servername/shutdownservices.bat that way so long as you share the folder that the bat file is on you should have all the relevant privilidges.
0
 

Author Comment

by:cdb424ttm
ID: 16271962
I get a error message telling me that "the network path can not be found"
0
 
LVL 6

Expert Comment

by:PreachDotNet
ID: 16278350
Don't forget to share the directory, if you do it right you should be able to see and run the bat file using windows explorer.
0
 
LVL 7

Expert Comment

by:CGretski
ID: 16278688
//servername/share is a unix convention
\\servername\share is windows'

PreachDotNet:  running the batch-file as you've mentioned won't change anything, it will just download the batch file to the local machine for execution anyway.... for remote execution you'd need something like psexec ( google pstools ) but that still relies on admin access to the machine to install it's remote service at run-time

0
 
LVL 6

Expert Comment

by:PreachDotNet
ID: 16278977
Doh, you are right of course...

http://www.sysinternals.com/utilities/psexec.html this freeware will do it though
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
Six Sigma Control Plans
Introduction to Processes

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question