How to start a Windows service from the command line on remote machine?
Does anyone know if there is a convinient way to start and stop a Windows service on remote machine from the command prompt.
Let's say you are logged on 192.168.0.1 and you are using its command line prompt. How can you start the MySQLService Windows service on 192.168.0.2?
Searching for something like:
C:\> remoteservice start MySQLService 192.168.0.2/username@password
Thanks in advance!
Good Answers (1)
PStools includes psservice. Pstools is well worth researching if you need to do remote CLI windows mgmt.
Links:
More Answers (6)
Roger D
IT Support (Contract) at Non-Profit
Best Answers in: Using LinkedIn (46), Computers and Software (4), Ethics (3), Customer Service (1), Travel Tools (1), Compensation and Benefits (1), Personnel Policies (1), Staffing and Recruiting (1), Advertising (1), Customer Relationship Management (1), Planning (1), Market Research and Definition (1), Telecommunications (1), Web Development (1)
I have used SC.EXE in the past for a variety of command-line, service-related tasks. It comes from the Windows Resource Kit and can be downloaded at the link below.
Links:
You not load up an MMC console for services and connect to another computer
Clarification added 3 months ago:
Sorry, that should have read.
You can load up MMC and choose the services snap-in and connect it to another computer to manage services remotely
Here is a Microsoft Technet Article on the Net start command, and it's current uses.
Links:
- http://technet2.microsoft.com/windowsserver/en/library/6c0a1e0b-ea5d-4a38-9...
- http://support.microsoft.com/kb/89482
Clarification added 3 months ago:
Also, you can remotely manage services through Active Directory.
Hi Peter!
You might consider using RemoteExec, a software solution that allows you to instantly and remotely execute programs (.exe, .bat, .cmd), scripts (.vbs, .js), program associated file types (.txt, .doc, .wav, .reg, .inf, .msi, ...), to copy folder(s)/file(s), ...
In your specific case, RemoteExec will remotely execute the following local script "net start MySQLService".
You will just have to provide RemoteExec with the IP address of the target system and appropriate authentication information.
Links:
Jeremy S
IT Director at MenuVantage
Best Answers in: Staffing and Recruiting (1), Software Development (1)
PSEXEC in PSTools is hands down the solution. I have used this tool for years in production environments for exactly what you are asking. We start/stop services on multiple cluster nodes from a single machine. You can even feed it a list of servers from a text file.
http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx
If you are comfortable with the Unix-world way of doing things, you can install (via e.g. Cygwin) and configure an sshd process (secure shell daemon) on your remote machines, and an ssh client on your own desktop machine; then you can subsequently open an ssh session to it ("ssh user@192.168.0.1") and then use the normal Windows command-line service commands, e.g. "net start mysqlservice". Of course, your desktop machine needn't be Windows, as long as you have an ssh client available. Cygwin has both the server and client, but you can also get stand-alone clients for Windows, for instance PuTTY.