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
33 views
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

https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc742019(v%3Dws.11)

The New-Service PowerShell cmdlet also works.

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-service?view=powershell-6


credit: Aura
Answered August 18, 2019
Your Answer
D:\Adnan\Candoerz\CandoProject\vQA