CLI で DescribeAvailablePatches を使用する - AWS Systems Manager

CLI で DescribeAvailablePatches を使用する

以下のコード例は、DescribeAvailablePatches の使用方法を示しています。

CLI
AWS CLI

利用可能なパッチを取得するには

次のdescribe-available-patches の例では、Windows Server 2019 で利用でき、MSRC 重要度が「緊急」のすべてのパッチに関する詳細情報を取得します。

aws ssm describe-available-patches \ --filters "Key=PRODUCT,Values=WindowsServer2019" "Key=MSRC_SEVERITY,Values=Critical"

出力:

{ "Patches": [ { "Id": "fe6bd8c2-3752-4c8b-ab3e-1a7ed08767ba", "ReleaseDate": 1544047205.0, "Title": "2018-11 Update for Windows Server 2019 for x64-based Systems (KB4470788)", "Description": "Install this update to resolve issues in Windows. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article for more information. After you install this item, you may have to restart your computer.", "ContentUrl": "https://support.microsoft.com/en-us/kb/4470788", "Vendor": "Microsoft", "ProductFamily": "Windows", "Product": "WindowsServer2019", "Classification": "SecurityUpdates", "MsrcSeverity": "Critical", "KbNumber": "KB4470788", "MsrcNumber": "", "Language": "All" }, { "Id": "c96115e1-5587-4115-b851-22baa46a3f11", "ReleaseDate": 1549994410.0, "Title": "2019-02 Security Update for Adobe Flash Player for Windows Server 2019 for x64-based Systems (KB4487038)", "Description": "A security issue has been identified in a Microsoft software product that could affect your system. You can help protect your system by installing this update from Microsoft. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article. After you install this update, you may have to restart your system.", "ContentUrl": "https://support.microsoft.com/en-us/kb/4487038", "Vendor": "Microsoft", "ProductFamily": "Windows", "Product": "WindowsServer2019", "Classification": "SecurityUpdates", "MsrcSeverity": "Critical", "KbNumber": "KB4487038", "MsrcNumber": "", "Language": "All" }, ... ] }

特定のパッチの詳細情報を取得するには

次の describe-available-patches の例では、指定されたパッチの詳細情報を取得します。

aws ssm describe-available-patches \ --filters "Key=PATCH_ID,Values=KB4480979"

出力:

{ "Patches": [ { "Id": "680861e3-fb75-432e-818e-d72e5f2be719", "ReleaseDate": 1546970408.0, "Title": "2019-01 Security Update for Adobe Flash Player for Windows Server 2016 for x64-based Systems (KB4480979)", "Description": "A security issue has been identified in a Microsoft software product that could affect your system. You can help protect your system by installing this update from Microsoft. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article. After you install this update, you may have to restart your system.", "ContentUrl": "https://support.microsoft.com/en-us/kb/4480979", "Vendor": "Microsoft", "ProductFamily": "Windows", "Product": "WindowsServer2016", "Classification": "SecurityUpdates", "MsrcSeverity": "Critical", "KbNumber": "KB4480979", "MsrcNumber": "", "Language": "All" } ] }

詳細については、「AWS Systems Manager ユーザーガイド」の「Patch Manager の動作の仕組み」を参照してください。

  • API の詳細については、「AWS CLI Command Reference」の「DescribeAvailablePatches」を参照してください。

PowerShell
Tools for PowerShell

例 1: この例では、Windows Server 2012 で利用でき、MSRC 重要度が「緊急」のすべてのパッチを取得します。この例で使用される構文には、PowerShell バージョン 3 以降が必要です。

$filter1 = @{Key="PRODUCT";Values=@("WindowsServer2012")} $filter2 = @{Key="MSRC_SEVERITY";Values=@("Critical")} Get-SSMAvailablePatch -Filter $filter1,$filter2

出力:

Classification : SecurityUpdates ContentUrl : https://support.microsoft.com/en-us/kb/2727528 Description : A security issue has been identified that could allow an unauthenticated remote attacker to compromise your system and gain control over it. You can help protect your system by installing this update from Microsoft. After you install this update, you may have to restart your system. Id : 1eb507be-2040-4eeb-803d-abc55700b715 KbNumber : KB2727528 Language : All MsrcNumber : MS12-072 MsrcSeverity : Critical Product : WindowsServer2012 ProductFamily : Windows ReleaseDate : 11/13/2012 6:00:00 PM Title : Security Update for Windows Server 2012 (KB2727528) Vendor : Microsoft ...

例 2: PowerShell バージョン 2 では、New-Object を使用して各フィルターを作成する必要があります。

$filter1 = New-Object Amazon.SimpleSystemsManagement.Model.PatchOrchestratorFilter $filter1.Key = "PRODUCT" $filter1.Values = "WindowsServer2012" $filter2 = New-Object Amazon.SimpleSystemsManagement.Model.PatchOrchestratorFilter $filter2.Key = "MSRC_SEVERITY" $filter2.Values = "Critical" Get-SSMAvailablePatch -Filter $filter1,$filter2

例 3: この例では、過去 20 日間にリリースされた、Windows Server 2019 に一致する製品に適用されるすべてのパッチの更新情報を取得します。

Get-SSMAvailablePatch | Where-Object ReleaseDate -ge (Get-Date).AddDays(-20) | Where-Object Product -eq "WindowsServer2019" | Select-Object ReleaseDate, Product, Title

出力:

ReleaseDate Product Title ----------- ------- ----- 4/9/2019 5:00:12 PM WindowsServer2019 2019-04 Security Update for Adobe Flash Player for Windows Server 2019 for x64-based Systems (KB4493478) 4/9/2019 5:00:06 PM WindowsServer2019 2019-04 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4493509) 4/2/2019 5:00:06 PM WindowsServer2019 2019-03 Servicing Stack Update for Windows Server 2019 for x64-based Systems (KB4493510)
  • API の詳細については、「AWS Tools for PowerShell Cmdlet リファレンス」の「DescribeAvailablePatches」を参照してください。

AWS SDK デベロッパーガイドとコード例の完全なリストについては、「AWS SDK で Systems Manager を使用する」を参照してください。このトピックには、使用開始方法に関する情報と、以前の SDK バージョンの詳細も含まれています。