0

On a computer a virtual instance of windows 7 is running. From a remote location I want to be able to stop and start services on this virtual instance of windows 7, given the IP address.

What is the EASIEST way to do this? There is no need to worry about any security issues! I am interested about the EASIEST and QUICKEST way to achieve this goal!

P.S. I have admin rights on both machines.

1
  • Please clarify that you only have local admin accounts, since the easiest way for a domain admin is grawity's solution, not yours. ;-) Commented Jul 15, 2014 at 15:24

2 Answers 2

2

Use sc:

sc \\1.2.3.4 query Foo
sc \\1.2.3.4 qc Foo
sc \\1.2.3.4 config Foo start= demand
sc \\1.2.3.4 start Foo
10
  • I get the following error: [SC] StartService: OpenService FAILED 1060: The specified service does not exist as an installed service.
    – Alex
    Commented Jul 15, 2014 at 8:06
  • @Alex: That might be because you got the name wrong, or because the service really doesn't exist. (sc wants the real name like LmServer, not the "display name". Run sc query.) Commented Jul 15, 2014 at 8:09
  • I tried sc \\172.16.4.154 stop "PNC - Pnms" to stop the existing service on the remote machine, but got the following error (in German): Set-Content : Es wurde kein Positionsparameter gefunden, der das Argument "PNC - Pnms" akzeptiert. Bei Zeile:1 Zeichen:3 + sc <<<< \\172.16.4.154 stop "PNC - Pnms" + CategoryInfo : InvalidArgument: (:) [Set-Content], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SetContentCommand
    – Alex
    Commented Jul 15, 2014 at 8:23
  • @Alex: Ah, it seems PowerShell overrides sc with an internal command. Try sc.exe \\172.16.4.154 instead. Commented Jul 15, 2014 at 8:24
  • Then I get an 'access denied' error (OpenSCManager ERROR 5)
    – Alex
    Commented Jul 15, 2014 at 8:29
1

The easiest way to achieve this goal might be to install PsTools and use the PsService command like:

./PsService.exe \\172.16.4.154 -u username -p password stop "name of service"

On the remote machine a service named Remote Registry must run in order to use the PsTools.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .