

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

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

# CLI で `DescribePatchGroupState` を使用する
<a name="ssm_example_ssm_DescribePatchGroupState_section"></a>

次のサンプルコードは、`DescribePatchGroupState` を使用する方法を説明しています。

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

**AWS CLI**  
**パッチグループの状態を取得するには**  
次の `describe-patch-group-state` の例では、パッチグループのパッチコンプライアンスの概要を取得します。  

```
aws ssm describe-patch-group-state \
    --patch-group "Production"
```
出力:  

```
{
    "Instances": 21,
    "InstancesWithCriticalNonCompliantPatches": 1,
    "InstancesWithFailedPatches": 2,
    "InstancesWithInstalledOtherPatches": 3,
    "InstancesWithInstalledPatches": 21,
    "InstancesWithInstalledPendingRebootPatches": 2,
    "InstancesWithInstalledRejectedPatches": 1,
    "InstancesWithMissingPatches": 3,
    "InstancesWithNotApplicablePatches": 4,
    "InstancesWithOtherNonCompliantPatches": 1,
    "InstancesWithSecurityNonCompliantPatches": 1,
    "InstancesWithUnreportedNotApplicablePatches": 2
}
```
詳細については、「*AWS Systems Manager ユーザーガイド*」の「パッチグループ」<https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-patch-patchgroups.html> および「[パッチコンプライアンス状態の値について](https://docs.aws.amazon.com/systems-manager/latest/userguide/about-patch-compliance-states.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribePatchGroupState](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ssm/describe-patch-group-state.html)」を参照してください。

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

**Tools for PowerShell V4**  
**例 1: この例では、パッチグループのパッチコンプライアンスの概要を取得します。**  

```
Get-SSMPatchGroupState -PatchGroup "Production"
```
**出力:**  

```
Instances                          : 4
InstancesWithFailedPatches         : 1
InstancesWithInstalledOtherPatches : 4
InstancesWithInstalledPatches      : 3
InstancesWithMissingPatches        : 0
InstancesWithNotApplicablePatches  : 0
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V4)* の「[DescribePatchGroupState](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: この例では、パッチグループのパッチコンプライアンスの概要を取得します。**  

```
Get-SSMPatchGroupState -PatchGroup "Production"
```
**出力:**  

```
Instances                          : 4
InstancesWithFailedPatches         : 1
InstancesWithInstalledOtherPatches : 4
InstancesWithInstalledPatches      : 3
InstancesWithMissingPatches        : 0
InstancesWithNotApplicablePatches  : 0
```
+  API の詳細については、AWS Tools for PowerShell コマンドレットリファレンス (V5) の「[DescribePatchGroupState](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。**

------