Sc.exe

From UVOO Tech Wiki
Revision as of 12:53, 6 May 2022 by Busk (talk | contribs)
Jump to navigation Jump to search

Set service to restart automatically. Set-Service does not do this

$sumohost = "myhostname"; Invoke-Command -ComputerName $sumohost -ScriptBlock { sc.exe failure sumo-collector reset=3600 actions= restart/30000 }

sc.exe Qfailure "zabbix agent 2"
sc.exe failure "zabbix agent 2" reset=3600 actions= restart/30000
SC failure YOUR_SERVICE_NAME reset= 0 actions= restart/0/restart/0/restart/0
SC Failure <servicename> actions= restart/<x delay in milliseconds>/restart/<y delay in milliseconds>/restart/<z delay in milliseconds>// reset= <number of seconds until failure count is reset>