Solved

Command Line to Stop / Start Services on Server

Posted on 2009-05-05
9
858 Views
Last Modified: 2013-11-09
How would I stop a service on a different server from the command line. I am on SERVER1 and want to stop a service on SERVER2 and then I want to start the service again.
0
Comment
Question by:jamesh1031
9 Comments
 
LVL 18

Expert Comment

by:flyingsky
ID: 24307769
0
 
LVL 4

Accepted Solution

by:
BillCarlin earned 500 total points
ID: 24307770
Easiest way is to use PSTools.  You can download from here:
https://technet.microsoft.com/en-us/sysinternals/bb896649.aspx?ppud=4

-Cheers
0
 
LVL 24

Expert Comment

by:Rajith Enchiparambil
ID: 24307971
Use netsvc (Command-line Service Controller - You can use NetSvc to remotely start, stop, and query the status of services from the command line) from 2000 resource kit tools
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:jamesh1031
ID: 24326863
If I am on 10.102.100.150 and want to stop a service on 10.102.100.151 named XZY what do i type in the command prompt on 150 to stop and start the service?
0
 
LVL 4

Assisted Solution

by:BillCarlin
BillCarlin earned 500 total points
ID: 24520136
If the author had looked at PSTOOLS using the link provided as instructed, he would have been given the direction and means to accomplish his task.  As taken from PsService:

PsService v2.22
By Mark Russinovich
Published: January 11, 2008
Introduction
PsService is a service viewer and controller for Windows. Like the SC utility that's included in the Windows NT and Windows 2000 Resource Kits, PsService displays the status, configuration, and dependencies of a service, and allows you to start, stop, pause, resume and restart them. Unlike the SC utility, PsService enables you to logon to a remote system using a different account, for cases when the account from which you run it doesn't have required permissions on the remote system. PsService includes a unique service-search capability, which identifies active instances of a service on your network. You would use the search feature if you wanted to locate systems running DHCP servers, for instance.

Finally, PsService works on both NT 4, Windows 2000 and Windows Vista, whereas the Windows 2000 Resource Kit version of SC requires Windows 2000, and PsService doesn't require you to manually enter a "resume index" in order to obtain a complete listing of service information.>

 

Installation
Just copy PsService onto your executable path, and type "psservice".


 

Using PsService
The default behavior of PsService is to display the configured services (both running and stopped) on the local system. Entering a command on the command-line invokes a particular feature, and some commands accept options. Typing a command followed by "- " displays information on the syntax for the command.

Usage: psservice [\\computer [-u username] [-p password]] <command> <options>

query Displays the status of a service.
config Displays the configuration of a service.
setconfig Sets the start type (disabled, auto, demand) of a service.
start Starts a service.
stop Stops a service.
restart Stops and then restarts a service.
pause Pauses a service
cont Resumes a paused service.
depend Lists the services dependent on the one specified.
security Dumps the service's security descriptor.
find Searches the network for the specified service.
\\computer Targets the NT/Win2K system specified. Include the -u switch with a username and password to login to the remote system if your security credentials do not permit you to obtain performance counter information from the remote system. If you specify the -u option, but not a password with the -p option, PsService will prompt you to enter the password and will not echo it to the screen.
0
 

Author Comment

by:jamesh1031
ID: 24526326
I still don't have enough of an answer to solve my problem.

If I am on 10.102.100.150 and want to stop a service on 10.102.100.151 named XZY what do i type in the command prompt on 150 to stop and start the service? Assume user name is user1 and password is password1. I have installed psservice on 150. Do I need it on 151 also? I don't see where the name of the service I want to stop should go. I don't know what the  brackets [ ] and <> mean. Looks like I leave the brackets and just place the command in place of the <command> (don't use <>)
 
psservice [\\computer [-u username] [-p password]] <command> <options>


0
 
LVL 4

Assisted Solution

by:BillCarlin
BillCarlin earned 500 total points
ID: 24527770
Please or launch psservice -? to learn how to use psservice
Examples:
Copied to Local Machine:
c:\temp\psservice -u AdminNameHere -p ******* setconfig seclogon auto
c:\temp\psservice -u AdminNameHere -p ******* start seclogon

From Master machine to remote:
psservice \\XZY restart spooler

You can run this from 1 master server and remote administer or if network firewalls don't permit, you can use the local option.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

861 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now