

Doc AWS SDK Examples GitHub リポジトリには、他にも SDK の例があります。 [AWS](https://github.com/awsdocs/aws-doc-sdk-examples)

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# CLI で `ListDocumentVersions` を使用する
<a name="ssm_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 コマンドリファレンス*.」の「[ListDocumentVersions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ssm/list-document-versions.html)」を参照してください。

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

**Tools for 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 コマンドレットリファレンス (V4)* の「[ListDocumentVersions](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for 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 コマンドレットリファレンス (V5) の「[ListDocumentVersions](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。**

------