Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.
share|improve this question

2 Answers 2

up vote 2 down vote accepted

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

share|improve this answer

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
share|improve this answer
    
Can you edit to give some actual instructions? That would make this answer more helpful to other visitors with the same problem. –  Canadian Luke Aug 26 at 22:32
    
@CanadianLuke Done. –  Boric Aug 27 at 14:28

Your Answer

 
discard

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.