none
Service Recovery Options

    Question

  • Hi,

    We're facing a problem about service recovery options for our services on Windows. We set the recovery option as "Restart The Service" but after some time, it turns to "Take No action" automatically. We do the setting as local administrator account on the machine. Is there a group policy about that? We use a cloud infrastructure and our machines are all VMs. So maybe our VM provider set a policy about that. This is very important for us to solve this problem since our services need to restart immediately when they go down. Please help with this issue.

    Thanks.


    • Edited by xkamerx Monday, March 13, 2017 11:10 AM
    Monday, March 13, 2017 11:09 AM

All replies

  • Hi,

    >> Is there a group policy about that? 

    In my server's GPO(with the latest GPO templates), the only related services settings is under here:

    Computer Configuration->Policies->Windows Settings->Security Settings->System Services

    But this GPO settings is used for auditing  the services status, e.g. start,stop,pause. if you want to audit, please follow steps below:  "locate the service you want to audit, and define its policy settings by clicking on Edit Security command button, which will display Security dialog box. Click on Advanced and define Auditing settings from there."I suppose if you enabled this audit policy, it will give you some helps to find out the root cause.

    >>We set the recovery option as "Restart The Service" but after some time, it turns to "Take No action" automatically. 

    You could use powershell script to do this, for instance:

    $service='MetaTrader4'
    if((gsv | ?{$_.name -eq $service}).Status -eq 'Stopped')
    {
        Start-Service $service -PassThru 
    }

    Modified version for loop:

    $service='MetaTrader4'
    while(1)
    {
        if((gsv | ?{$_.name -eq $service}).Status -eq 'Stopped')
        {
            Start-Service $service -PassThru 
        }else{
            Write-Host "The servie is already started!"
        }
        Start-Sleep 60 #waiting for 1min to check if this service has been stopped
    }

    Note: if you want to successfully run this script, you need to enable the PS execute policies on your target computer and run this script with admin privilege. 

    Here is the command: 

    Set-ExecutionPolicy unrestricted

    Not suggest operate it on production server.

    >>We use a cloud infrastructure and our machines are all VMs. So maybe our VM provider set a policy about that. 

    Descriptions here is too vague, which could platform did you use? Azure? what VM platform did you get? Hyper-v or VMware or citrix? Did you cloud infrastructure has any special settings that lead this issue?

    we need more information, if you need to find out the root cause for this issue.

    In addition, personal suggestion: for services we could use a dedicated service account to  serve them. For instance, old windows server you could consider using MSA while on new windows server you try gMSA. Very easy to deploy and maintenance.

    Below is a blog to illustration:

    https://blogs.technet.microsoft.com/askpfeplat/2012/12/16/windows-server-2012-group-managed-service-accounts/

    Best regards,

    Andy


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Tuesday, March 14, 2017 4:46 AM
    Moderator
  • Hello,

    command above for a service which is stopped already.

    we need to check the service's recovery option which is "take no action"

    if so change it to "restart the service"

    Regards

    Tuesday, March 14, 2017 12:24 PM
  • Hi,

    sorry for the late reply.

    >>we need to check the service's recovery option which is "take no action"

    could you please provide your script and i'll help to troubleshooting.

    Best regards,

    Andy


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Monday, April 10, 2017 6:36 AM
    Moderator