DescribePatchGroupState 搭配 CLI 使用 - AWS SDK 程式碼範例

文件 AWS SDK AWS 範例 SDK 儲存庫中有更多可用的 GitHub 範例。

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

DescribePatchGroupState 搭配 CLI 使用

下列程式碼範例示範如何使用 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/sysmanWord-patch-patchgroups.html>__ 和了解修補程式合規狀態值

PowerShell
for PowerShell 工具

範例 1:此範例會取得修補程式群組的高階修補程式合規摘要。

Get-SSMPatchGroupState -PatchGroup "Production"

輸出:

Instances : 4 InstancesWithFailedPatches : 1 InstancesWithInstalledOtherPatches : 4 InstancesWithInstalledPatches : 3 InstancesWithMissingPatches : 0 InstancesWithNotApplicablePatches : 0