I want a process (exe) to be always running on machine, even after it reboots. I've setup powershell DSC and currently I had it as a WindowsProcess and its not launched after reboot. Can someone tell me whats the recommended resource to be used for this scenario ?
Asked
Active
Viewed 105 times
1 Answers
0
You dont really need DSC for that, just create a service with startup type of auto with the sc
command. plenty of examples online.
sc create <servicename> binpath= "<pathtobinaryexecutable>" [option1] [option2] [optionN]
You can use Service to create services as well. Something like this should work:
configuration ServiceTest
{
Import-DscResource -ModuleName PSDesiredStateConfiguration
Node localhost
{
Service ServiceExample
{
Name = "TermService"
StartupType = "Manual"
State = "Running"
Path = "path\to\binary
}
}
}

4c74356b41
- 69,186
- 6
- 100
- 141
-
Thanks for your response. But I kind of need DSC for other purposes. I'm need to install something on my host machines of my kubernetes cluster. That's why I chose to use DSC and for the first time, it sets it up correctly and runs my exe. But I want to run this whenever a machine reboots as well. I can try to use this sc command in my WindowsProcess it self – sai guru datt manchikanti Nov 16 '18 at 20:27
-
check updated answer, if you still need dsc, you might as well use dsc to do that – 4c74356b41 Nov 16 '18 at 20:29