

• AWS Systems Manager CloudWatch 控制面板在 2026 年 4 月 30 日之后将不再可用。客户可以像现在一样继续使用 Amazon CloudWatch 控制台来查看、创建和管理其 Amazon CloudWatch 控制面板。有关更多信息，请参阅 [Amazon CloudWatch 控制面板文档](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Dashboards.html)。

# 将 `DescribeMaintenanceWindows` 与 CLI 配合使用
<a name="example_ssm_DescribeMaintenanceWindows_section"></a>

以下代码示例演示如何使用 `DescribeMaintenanceWindows`。

------
#### [ CLI ]

**AWS CLI**  
**示例 1：列出所有维护时段**  
以下 `describe-maintenance-windows` 示例列出当前区域中您 AWS 账户的所有维护时段。  

```
aws ssm describe-maintenance-windows
```
输出：  

```
{
    "WindowIdentities": [
        {
            "WindowId": "mw-0ecb1226ddEXAMPLE",
            "Name": "MyMaintenanceWindow-1",
            "Enabled": true,
            "Duration": 2,
            "Cutoff": 1,
            "Schedule": "rate(180 minutes)",
            "NextExecutionTime": "2020-02-12T23:19:20.596Z"
        },
        {
            "WindowId": "mw-03eb9db428EXAMPLE",
            "Name": "MyMaintenanceWindow-2",
            "Enabled": true,
            "Duration": 3,
            "Cutoff": 1,
            "Schedule": "rate(7 days)",
            "NextExecutionTime": "2020-02-17T23:22:00.956Z"
        },
    ]
}
```
**示例 2：列出所有已启用的维护时段**  
以下 `describe-maintenance-windows` 示例列出所有已启用的维护时段。  

```
aws ssm describe-maintenance-windows \
    --filters "Key=Enabled,Values=true"
```
**示例 3：列出与特定名称匹配的维护时段**  
此 `describe-maintenance-windows` 示例列出具有指定名称的所有维护时段。  

```
aws ssm describe-maintenance-windows \
    --filters "Key=Name,Values=MyMaintenanceWindow"
```
有关更多信息，请参阅《AWS Systems Manager 用户指南》**中的[查看有关维护时段的信息（AWS CLI）](https://docs.aws.amazon.com/systems-manager/latest/userguide/maintenance-windows-cli-tutorials-describe.html)。  
+  有关 API 详细信息，请参阅《AWS CLI Command Reference》**中的 [DescribeMaintenanceWindows](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ssm/describe-maintenance-windows.html)。

------
#### [ PowerShell ]

**适用于 PowerShell V4 的工具**  
**示例 1：此示例列出您账户中的所有维护时段。**  

```
Get-SSMMaintenanceWindowList
```
**输出**：  

```
Cutoff   : 1
Duration : 4
Enabled  : True
Name     : My-First-Maintenance-Window
WindowId : mw-06d59c1a07c022145
```
+  有关 API 详细信息，请参阅《AWS Tools for PowerShell Cmdlet Reference（V4）》中的 [DescribeMaintenanceWindows](https://docs.aws.amazon.com/powershell/v4/reference)**。

**适用于 PowerShell V5 的工具**  
**示例 1：此示例列出您账户中的所有维护时段。**  

```
Get-SSMMaintenanceWindowList
```
**输出**：  

```
Cutoff   : 1
Duration : 4
Enabled  : True
Name     : My-First-Maintenance-Window
WindowId : mw-06d59c1a07c022145
```
+  有关 API 详细信息，请参阅《*AWS Tools for PowerShell Cmdlet 参考 (V5)*》中的 [DescribeMaintenanceWindows](https://docs.aws.amazon.com/powershell/v5/reference)。

------

有关 AWS SDK 开发人员指南和代码示例的完整列表，请参阅 [将此服务与 AWS SDK 结合使用](sdk-general-information-section.md) 本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。