The most reliable service persistence uses a proper Windows service executable. A normal console binary may start and execute, but the Service Control Manager can mark it failed because it does not speak the service protocol.
- Place the service binary in a stable path
- Create the service
- Set it to auto-start
- Start the service
- Verify service state and execution
Create a service:
sc.exe create OOTWUpdate binPath= "C:\ProgramData\Microsoft\Windows\ootwsvc.exe" start= auto obj= LocalSystem DisplayName= "Windows Update Helper"
Start it:
sc.exe start OOTWUpdate
Verify:
sc.exe qc OOTWUpdate
sc.exe query OOTWUpdate
PowerShell alternative:
New-Service -Name "OOTWUpdate" -BinaryPathName "C:\ProgramData\Microsoft\Windows\ootwsvc.exe" -DisplayName "Windows Update Helper" -StartupType Automatic
Start-Service OOTWUpdate