Services start/stop

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?
cdb424ttmAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PreachDotNetCommented:
You can write a batch file to accomplish this

http://www.tech-recipes.com/batch_file_programming_tips235.html
0
liviutudorCommented:
use "net stop" and "net start" command -- type net start /? or net stop /? for details.
0
CGretskiCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

cdb424ttmAuthor Commented:
that is what I'm looking for thanks All
0
cdb424ttmAuthor Commented:
sc \\sfmnntgso4 stop cdr-printengine  that did not work, CGretski
0
CGretskiCommented:
what error did it give?
0
cdb424ttmAuthor Commented:
nothing I jusst look at the services and it was still running
0
CGretskiCommented:
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
cdb424ttmAuthor Commented:
[SC] openscmanger failed 1722
the rpc server is unavailable
0
CGretskiCommented:
that suggests either the servername is wrong, or it's behind some firewall/proxy that's filtering RPC
0
cdb424ttmAuthor Commented:
so I need to do this on there machine?

0
CGretskiCommented:
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
PreachDotNetCommented:
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
cdb424ttmAuthor Commented:
I get a error message telling me that "the network path can not be found"
0
PreachDotNetCommented:
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
CGretskiCommented:
//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
PreachDotNetCommented:
Doh, you are right of course...

http://www.sysinternals.com/utilities/psexec.html this freeware will do it though
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

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.