tags:

views:

664

answers:

3

I have a requirement in the project such that we have to stop a specific service say "x" in a remote machine (which is on the same LAN), change the registry key remotely and start the service again.

I tried the command sc \server stop service, but I got the error:

[SC] GetServiceKeyName FAILED 1060:

The specified service does not exist as an installed service.

I am using Windows 2003 SP1. Are there any built in commands or APIs that are available on Windows?

I need the commmand to run on the command prompt.

A: 

Use OpenCSManager, then OpenService, then StartService.

sharptooth
+1  A: 

From this URL:

To stop a service remotely you can use the command sc.

Example:
> sc \\computer stop "Service Name"
> sc \\computer start "Service Name"

Perhaps you are missing a "\" character?

gahooa
+1  A: 

You may want to look into PSTools from SysInternals. Those tools are freely available and can help you manage processes on a remote Windows machine.

The tools included in the PsTools suite, which are downloadable as a package, are:

PsExec - execute processes remotely
PsFile - shows files opened remotely
PsGetSid - display the SID of a computer or a user
PsInfo - list information about a system
PsKill - kill processes by name or process ID
PsList - list detailed information about processes
PsLoggedOn - see who's logged on locally and via resource sharing 
PsLogList - dump event log records
PsPasswd - changes account passwords
PsService - view and control services
PsShutdown - shuts down and optionally reboots a computer
PsSuspend - suspends processes
PsUptime - shows you how long a system has been running since its last reboot
David Segonds