Solved

Command Line to Stop / Start Services on Server

Posted on 2009-05-05
9
856 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Exchange Mailbox 2 38
Exchange 2013 ECP log me out 3 20
cached or not 5 46
Disk Ram Peak 1 19
Check out this infographic on what you need to make a good email signature that will work perfectly for your organization.
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
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)
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

762 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

19 Experts available now in Live!

Get 1:1 Help Now