1

I have the same service running on a dozen test machines. Said service has croaked (specifically, it was shut down and disabled by a test, and the test died halfway through), and I want to re-enable and restart it on all of those machines. The normal solution is sc \\machine config ServiceName start=auto followed by sc \\machine start ServiceName, and it works fine if my user account is authorized on the other machine. But since these are cloned test machines created from a common image that doesn't know me from Adam, they don't recognize me. I know I could go in and authorize myself on those machines, but they get wiped on a fairly regular basis and I'm trying to save some time.

I know the local Administrator password for all of these machines. (And it's the same thing, due to the cloning.) How can I run sc.exe so that it will log in with that user? Or is there another way I can enable and start those services programatically from my machine? (I have a dead-simple looping PowerShell script all ready to go, but it's not much use if I can't find a command to run that will be accepted.)

For reference, here's the error message I'm getting:

[SC] OpenSCManager FAILED 5:

Access is denied.

2 Answers 2

2

sc \\machine config ServiceName start= auto obj= Username password= PWD

3

Use PsTools, which works just like sc.exe but it enables you to logon to a remote system using a different account. Go here to download it. Usage is psservice [\\computer [-u username] [-p password]] <command> <options> using the same commands as sc.exe. So given your example, you would enter

psservice \\machine -u AdminUserName -p AdminPassword config ServiceName start=auto

and then

psservice \\machine -u AdminUserName -p AdminPassword start ServiceName
2
  • Can you edit to give some actual instructions? That would make this answer more helpful to other visitors with the same problem. Aug 26, 2014 at 22:32
  • @CanadianLuke Done.
    – Boric
    Aug 27, 2014 at 14:28

You must log in to answer this question.

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