Skip to main content

What is the "official" way to create/configure a service under Windows? [Resolved]

When I use sc create "myService" binpath= “C:\Program Files\myService\myService.exe" I have no way to configure some aspects of the service. In particular the Recovery tab seen in services.msc (action on first failure, action on second failure, restart service after, etc).

I currently manually modify these parameters, but is there a better method?
A PowerShell command or so? What I found about PowerShell do not allow much better than sc.

Question Credit: Gregory MOUSSAT
Question Reference
Asked August 18, 2019
Posted Under: Network
1 Answers

If you want to configure the Recovery options for a service that you create using the sc command, you can use the failure option to set them.

sc failure

The New-Service PowerShell cmdlet also works.

credit: Aura
Answered August 18, 2019
Your Answer