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

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

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

UpdatePatchBaseline 搭配 使用 CLI

下列程式碼範例示範如何使用 UpdatePatchBaseline

CLI
AWS CLI

範例 1:更新修補程式基準

下列update-patch-baseline範例會將指定的兩個修補程式新增為已拒絕,並將一個修補程式新增為已核准到指定的修補程式基準。

aws ssm update-patch-baseline \ --baseline-id "pb-0123456789abcdef0" \ --rejected-patches "KB2032276" "MS10-048" \ --approved-patches "KB2124261"

輸出:

{ "BaselineId": "pb-0123456789abcdef0", "Name": "WindowsPatching", "OperatingSystem": "WINDOWS", "GlobalFilters": { "PatchFilters": [] }, "ApprovalRules": { "PatchRules": [ { "PatchFilterGroup": { "PatchFilters": [ { "Key": "PRODUCT", "Values": [ "WindowsServer2016" ] } ] }, "ComplianceLevel": "CRITICAL", "ApproveAfterDays": 0, "EnableNonSecurity": false } ] }, "ApprovedPatches": [ "KB2124261" ], "ApprovedPatchesComplianceLevel": "UNSPECIFIED", "ApprovedPatchesEnableNonSecurity": false, "RejectedPatches": [ "KB2032276", "MS10-048" ], "RejectedPatchesAction": "ALLOW_AS_DEPENDENCY", "CreatedDate": 1550244180.465, "ModifiedDate": 1550244180.465, "Description": "Patches for Windows Servers", "Sources": [] }

範例 2:重新命名修補程式基準

下列update-patch-baseline範例會重新命名指定的修補程式基準。

aws ssm update-patch-baseline \ --baseline-id "pb-0713accee01234567" \ --name "Windows-Server-2012-R2-Important-and-Critical-Security-Updates"

如需詳細資訊,請參閱 AWS Systems Manager 使用者指南中的更新或刪除修補程式基準 <https://docs.aws.amazon.com/systems-manager/latest/userguide/patch-baseline-update-or-delete.html>`__。

PowerShell
適用於 的工具 PowerShell

範例 1:此範例會將兩個修補程式新增為已拒絕,並將一個修補程式新增為已核准的現有修補程式基準。

Update-SSMPatchBaseline -BaselineId "pb-03da896ca3b68b639" -RejectedPatch "KB2032276","MS10-048" -ApprovedPatch "KB2124261"

輸出:

ApprovalRules : Amazon.SimpleSystemsManagement.Model.PatchRuleGroup ApprovedPatches : {KB2124261} BaselineId : pb-03da896ca3b68b639 CreatedDate : 3/3/2017 5:02:19 PM Description : Baseline containing all updates approved for production systems GlobalFilters : Amazon.SimpleSystemsManagement.Model.PatchFilterGroup ModifiedDate : 3/3/2017 5:22:10 PM Name : Production-Baseline RejectedPatches : {KB2032276, MS10-048}
  • 如需API詳細資訊,請參閱 AWS Tools for PowerShell Cmdlet 參考 UpdatePatchBaseline中的 。