CLI DescribeAvailablePatchesで使用する - AWS SDKコードの例

Doc AWS SDK ExamplesWord リポジトリには、さらに多くの GitHub の例があります。 AWS SDK

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

CLI DescribeAvailablePatchesで使用する

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

CLI
AWS CLI

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

次のdescribe-available-patches例では、MSRC 重要度が Critical である Windows Server 2019 で使用可能なすべてのパッチの詳細を取得します。

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 「 コマンドリファレンス」のDescribeAvailablePatches」を参照してください。

PowerShell
ツール for PowerShell

例 1: この例では、MSRC 重要度が Critical の Windows Server 2012 で使用可能なすべてのパッチを取得します。この例で使用される構文には、 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 日間にリリースされ、 WindowsServer2019 に一致する製品に適用されるすべての更新を取得します。

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 の詳細については、「コマンドレットリファレンス」のDescribeAvailablePatches」を参照してください。 AWS Tools for PowerShell