Solved

Command Line to Stop / Start Services on Server

Posted on 2009-05-05
9
867 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

 

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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
how to add IIS SMTP to handle application/Scanner relays into office 365.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

734 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