Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows API
  4. Read/get Windows service recovery/failure information

Read/get Windows service recovery/failure information

Scheduled Pinned Locked Moved Windows API
helptutorialquestion
5 Posts 3 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mc_Topaz
    wrote on last edited by
    #1

    Hello! I find a lot of information how to set the recovery action for a Windows service. For instance this command:

    sc failure "Service name" reset= 86400 actions= restart/60000/restart/60000/restart/60000

    This command will set the reset error-counter after 86400 seconds and have three actions to restart the service after 60000ms. Is there some command I can use to get the recovery/failure information from a Windows service? Best regards, /Steffe

    Richard Andrew x64R 1 Reply Last reply
    0
    • M Mc_Topaz

      Hello! I find a lot of information how to set the recovery action for a Windows service. For instance this command:

      sc failure "Service name" reset= 86400 actions= restart/60000/restart/60000/restart/60000

      This command will set the reset error-counter after 86400 seconds and have three actions to restart the service after 60000ms. Is there some command I can use to get the recovery/failure information from a Windows service? Best regards, /Steffe

      Richard Andrew x64R Offline
      Richard Andrew x64R Offline
      Richard Andrew x64
      wrote on last edited by
      #2

      See: Service Functions[^] Particularly QueryServiceConfig & QueryServiceConfig2 .

      The difficult we do right away... ...the impossible takes slightly longer.

      M 1 Reply Last reply
      0
      • Richard Andrew x64R Richard Andrew x64

        See: Service Functions[^] Particularly QueryServiceConfig & QueryServiceConfig2 .

        The difficult we do right away... ...the impossible takes slightly longer.

        M Offline
        M Offline
        Mc_Topaz
        wrote on last edited by
        #3

        Thanks! Is it possible to get the information directly in the Windows terminal?

        Richard DeemingR 1 Reply Last reply
        0
        • M Mc_Topaz

          Thanks! Is it possible to get the information directly in the Windows terminal?

          Richard DeemingR Offline
          Richard DeemingR Offline
          Richard Deeming
          wrote on last edited by
          #4

          Not really on-topic for a programming forum, but you should be able to use sc qfailure {service}[^] to list the failure actions.


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

          M 1 Reply Last reply
          0
          • Richard DeemingR Richard Deeming

            Not really on-topic for a programming forum, but you should be able to use sc qfailure {service}[^] to list the failure actions.


            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

            M Offline
            M Offline
            Mc_Topaz
            wrote on last edited by
            #5

            Thank you! I'm trying to map this to C#. I thought I could get a generic answer in the Windows API forum first before I try with C#. /Steffe

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups