Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Command Line to Stop / Start Services on Server

Posted on 2009-05-05
9
Medium Priority
?
872 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 2000 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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 

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 2000 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 2000 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

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
New style of hardware planning for Microsoft Exchange server.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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)

722 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