docs.microsoft.com
Open in
urlscan Pro
2a02:26f0:480:389::353e
Public Scan
URL:
https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc742019(v%3Dws.11)
Submission: On July 20 via manual from US — Scanned from DE
Submission: On July 20 via manual from US — Scanned from DE
Form analysis
0 forms found in the DOMText Content
Skip to main content This browser is no longer supported. Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support. Download Microsoft Edge More info Table of contents Exit focus mode Read in English Save Table of contents Read in English Save Twitter LinkedIn Facebook Email Table of contents SC FAILURE * Article * 08/31/2016 * 2 minutes to read IN THIS ARTICLE Applies To: Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7, Windows Server 2003 with SP2, Windows Server 2003 R2, Windows Server 2008 R2, Windows Server 2012, Windows Server 2003 with SP1, Windows 8 Specifies one or more actions to take if a service fails. For examples of how to use this command, see Examples. SYNTAX sc [<ServerName>] failure [<ServiceName>] [reset= <ErrorFreePeriod>] [reboot= <BroadcastMessage>] [command= <CommandLine>] [actions= {"" | {[run/<MS>] | [restart/<MS>] | [reboot/<MS>]}[/...]] PARAMETERS Parameter Description <ServerName> Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \\myserver). To run SC.exe locally, omit this parameter. <ServiceName> Specifies the service name returned by the getkeyname operation. reset= <ErrorFreePeriod> Specifies the length of the period (in seconds) with no failures after which the failure count should be reset to 0 (zero). Note that this parameter requires the actions= parameter. reboot= <BroadcastMessage> Specifies the message to be broadcast when a service fails. command= <CommandLine> Specifies the command-line command to be run when the specified service fails. For more information about how to run a batch or VBS file on failure, see Remarks. actions= {"" | {[run/<MS>] | [restart/<MS>] | [reboot/<MS>]}[/...] Specifies one or more failure actions and their delay times (in milliseconds), separated by a forward slash (/). Valid actions are run, restart, and reboot. If more than one action is specified, each action must be separated by a forward slash. Use actions= "" to take no action a service fails. Note that this parameter requires the reset= parameter. /? Displays help at the command prompt. REMARKS * Not all services allow changes to their failure options. Some run as part of a service set. * To run a batch file when a service fails, specify command= Cmd.exe** **Drive:\FileName.bat, where Drive:\FileName.bat is the fully qualified name of the batch file. * To run a VBS file when a service fails, specify command= Cscript Drive:\MyScript.vbs, where Drive:\MyScript.vbs is the fully qualified name of the script file. * You can specify up to three separate actions with the actions= parameter, to be used the first, second, and third times that a service fails. * For each command-line option (parameter), the equal sign is part of the option name. * A space is required between an option and its value (for example, actions= restart). If the space is omitted, the operation will fail. EXAMPLES The following examples show how you can use the sc failure command: sc failure msftpsvc reset= 30 actions= restart/5000 sc failure dfs reset= 60 command= c:\windows\services\restart_dfs.exe actions= run/5000 sc failure dfs reset= 60 actions= reboot/30000 sc failure dfs reset= 60 reboot= "The Distributed File System service has failed. Because of this, the computer will reboot in 30 seconds." actions= reboot/30000 sc failure myservice reset= 3600 reboot= "MyService crashed -- rebooting machine" command= "%windir%\MyServiceRecovery.exe" actions= restart/5000/run/10000/reboot/60000 ADDITIONAL REFERENCES Command-Line Syntax Key Theme * Light * Dark * High contrast * * Previous Version Docs * Blog * Contribute * Privacy & Cookies * Terms of Use * Trademarks * © Microsoft 2022 IN THIS ARTICLE Theme * Light * Dark * High contrast * * Previous Version Docs * Blog * Contribute * Privacy & Cookies * Terms of Use * Trademarks * © Microsoft 2022