This template creates an AWS Systems Manager maintenance window task that runs a Run Command task. The task targets instances using a maintenance window target ID. The task runs a PowerShell script that includes commands to restart a service, get the execution policy, and set the execution policy.

CloudFormation Template