

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

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

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

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

**AWS CLI**  
**列出文档版本**  
以下 `list-document-versions` 示例列出 Systems Manager 文档的所有版本。  

```
aws ssm list-document-versions \
    --name "Example"
```
输出：  

```
{
    "DocumentVersions": [
        {
            "Name": "Example",
            "DocumentVersion": "1",
            "CreatedDate": 1583257938.266,
            "IsDefaultVersion": true,
            "DocumentFormat": "YAML",
            "Status": "Active"
        }
    ]
}
```
有关更多信息，请参阅《AWS Systems Manager 用户指南》**中的[发送使用文档版本参数的命令](https://docs.aws.amazon.com/systems-manager/latest/userguide/run-command-version.html)。  
+  有关 API 详细信息，请参阅《AWS CLI Command Reference》**中的 [ListDocumentVersions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ssm/list-document-versions.html)。

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

**适用于 PowerShell V4 的工具**  
**示例 1：此示例列出文档的所有版本。**  

```
Get-SSMDocumentVersionList -Name "AWS-UpdateSSMAgent"
```
**输出**：  

```
CreatedDate       : 6/1/2021 5:19:10 PM
DocumentFormat    : JSON
DocumentVersion   : 1
IsDefaultVersion  : True
Name              : AWS-UpdateSSMAgent
Status            : Active
```
+  有关 API 详细信息，请参阅《AWS Tools for PowerShell Cmdlet Reference（V4）》中的 [ListDocumentVersions](https://docs.aws.amazon.com/powershell/v4/reference)**。

**适用于 PowerShell V5 的工具**  
**示例 1：此示例列出文档的所有版本。**  

```
Get-SSMDocumentVersionList -Name "AWS-UpdateSSMAgent"
```
**输出**：  

```
CreatedDate       : 6/1/2021 5:19:10 PM
DocumentFormat    : JSON
DocumentVersion   : 1
IsDefaultVersion  : True
Name              : AWS-UpdateSSMAgent
Status            : Active
```
+  有关 API 详细信息，请参阅《*AWS Tools for PowerShell Cmdlet 参考 (V5)*》中的 [ListDocumentVersions](https://docs.aws.amazon.com/powershell/v5/reference)。

------

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