0

We have a server that hosts a service (I'll call it "tomato").

Up until now, a client pc has been able to start and stop this service. They just double-click a batch file, and inside that batch file is the command

net stop tomato

or

net start tomato

They recently got a new physical computer, and now those same commands fail with the error:

C:\>net stop tomato
The service name is invalid.

More help is available by typing NET HELPMSG 2185.

What do I need to do to let the client pc start and stop this service remotely?

Edit: I mis-remembered the original commands. They were not using "net start" and "net stop" remotely. They were using

sc \\server_name start tomato

and

sc \\server_name stop tomato

And those commands to indeed still work.

  • Is he running this command on the server? – Col Sep 8 '09 at 12:25
  • No, running it on the client, issuing the command to the server. – JosephStyons Sep 8 '09 at 12:52
4

the "net start/stop" commands can only start or stop services locally, on the same computer. You cannot use it to start or stop services running on another computer.

For this, you could use for instance psservice, part of the PsTools from Sysinternals. With the right parameters, you can control services on a remote computer, providing you have the correct credentials to do it.

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

| improve this answer | |
0

I was forced to start several services on a variety of servers where PowerShell was giving me a

The WSMan service...

error. Since there was a hurry to complete the task, I decided to combine PsService with PowerShell. I created separate files, each containing the servers that were in need to get the same specific service started, and then ran them using this sample code in PS:

$service = "<short service name even with spaces here>"
$servers = Get-Content .\servers.txt
$servers | % {
 Write-Host -NoNewline "Processing server/service: "; Write-Host -NoNewline -ForegroundColor Green $_; Write-Host -NoNewline -ForegroundColor White "/"; Write-Host -ForegroundColor Green $service
 psservice \\$_ start $service
}

I hope this helps.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.