Support Automation Workflow (SAW) Runbook: AWSSupport-ManageWindowsService

3 minute read
Content level: Intermediate
1

How can I use the AWSSupport-ManageWindowsService Systems Manager Automation runbook to stop, start, restart, pause, or disable a Windows Service on a target managed Windows instance?

The AWSSupport-ManageWindowsService runbook enables you to stop, start, restart, pause, or disable a Windows Service on the target managed instance.

In this article, I will show you how to use the AWSSupport-ManageWindowsService Systems Manager automation runbook to manage the lifecycle of Window Services. This is useful when you want to remotely manage Windows Services on a target Windows managed instance.

Learn more about Support Automation Workflows >>

How it works?

AWSSupport-ManageWindowsService workflow executes the following three steps:

  1. Checks that managed instance is Online
  2. Checks the provided instance's platform is Windows
  3. Runs the PowerShell script to apply the desired configuration to the Windows service on the target instance

The successful runbook execution output will show you the changes that occurred to the Service status and Service startup type.

If the runbook execution fails, there are the following possible outputs:

  • The Service name is invalid.
  • Stopping a service with dependencies.
  • Invalid Service Action and Startup Type combinations (e.g. starting a service while also trying to keep the service disabled).
  • Invalid Actions and Startup Types that are not supported by the service.

Prerequisites

Before running the automation make sure your user or the IAM service role has the permissions listed in the Required IAM permissions section.

Instructions

  1. Navigate to the Systems Manager console
  2. In the navigation pane, choose Documents
  3. In the document search type AWSSupport-ManageWindowsService
  4. Select AWSSupport-ManageWindowsService document
  5. Click on Execute automation
  6. For the input parameters enter the following:
    • InstanceId (required): This is the ID of the managed instance.
    • ServiceAction (required): An action you want to apply to the Windows service. Default value: Check. Note that you can use Force-Restart and Force-Stop to restart and to stop a service that has dependent services. Valid values: Check | Restart | Force-Restart | Start | Stop | Force-Stop | Pause.
    • StartupType (required): A startup type you will apply to the Windows service. Default value: Check. Valid values: Check | Auto | Demand | Disabled | DelayedAutoStart.
    • WindowsServiceName (required): A valid Windows service name.
    • AutomationAssumeRole (optional): This is the Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that allows Systems Manager Automation to perform the actions on your behalf. If no role is specified, Systems Manager Automation will use the permissions of the user that starts this runbook.

The following example demonstrates how to use the AWSSupport-ManageWindowsService automation runbook in order to restart Windows Time service (W32Time).

AWSSupport-ManageWindowsService Input Parameters example

  1. Click on Execute
  2. You should see that the automation has been initiated
  3. Once completed, you can review the Outputs section for the detailed results of the execution

AWSSupport-ManageWindowsService output

Conclusion

In this article, I have shown how to manage (stop, start, restart, pause, or disable ) any Windows service on the target instance by using the SAW runbook AWSSupport-ManageWindowsService, available in System Manager.

References

Systems Manager Automation

Run this Automation (console)

Running a simple automation: https://docs.aws.amazon.com/systems-manager/latest/userguide/automation-working-executing.html

Setting up Automation: https://docs.aws.amazon.com/systems-manager/latest/userguide/automation-setup.html

Documentation related to the AWS service

For more information how to run this runbook, please see the AWS public document: AWSSupport-ManageWindowsService.

To help you troubleshoot, remediate, manage, and reduce costs on your AWS resources, AWS Support maintains a subset of the AWS provided predefined runbooks . These runbooks are prefixed with “AWSSupport-“ or “AWSPremiumSupport-“.