Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I got administrative rights on the target machine, all the credentials, fully trusted network without firewall and antivirus software. I got windows 8 on the target machine and windows 7 on calling one.

  • I need to restart a windows service by its name. I have this name.

I got the IP address of that machine. I have the simple shell. I could use the powershell however.

Still I cannot find on the internet the fine shell command to do this. Everything I find says either it is impossble or providing not working piece of code.

Update: Both computers are located ta my home and does not belong to domain. They only share teh same workgroup.


Just created a powershell script:

$password = convertto-securestring -string 'pwd_string' -asplaintext -force
$credential = new-object -typename System.Management.Automation.PSCredential -argumentlist "AF", $password
$service = gwmi win32_service -computername "AgentFire" -filter "name='Sharedaccess'" -credential $credential
Start-Sleep -s 3

gwmi says access denied, though credentials are valid.

share|improve this question

You can try something like this:

sc \\SERVER [start|stop|restart] ServiceName

Works from Windows 8 to Server 2012.

share|improve this answer
[SC] StartService: OpenService FAILED 5: access denied. – AgentFire Apr 4 '13 at 6:57
How to, at first, logon to the remote machine? – AgentFire Apr 4 '13 at 12:52
up vote 1 down vote accepted

The only way I could manage to do this is:

PsExec.exe \\ -u 123 -p 123 -d shutdown /f /s /t 0
  1. External tool from SysInternals.
  2. User-password combo on the target PC
  3. Shutdown.exe shell command.
share|improve this answer

If I'm wrong, please let me know.

According to this site you should be able to use the net [start/stop] [servicename] command to start or stop a service by its name. If you just need to kill a process, you could just get the PID by using tasklist and taskkill with the appropriate flags.

share|improve this answer
This does not work when I run it on one machine to restart a service on another machine. – AgentFire Apr 4 '13 at 6:23
I have both, simple and power. – AgentFire Apr 4 '13 at 6:58
What error do you get? – cutrightjm Apr 4 '13 at 7:02
With net [start/stop] [servicename] there is no error as well as any attempt. The command you provided does not allow to specify the remote machine name. Or I cannot find where this can be specified. – AgentFire Apr 4 '13 at 7:09
You said you had a shell into the second computer. If you had this you wouldn't need to specify the machine name. – cutrightjm Apr 4 '13 at 7:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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