AWS code-library documentation change
Summary
Added PowerShell examples for filtering available patches by MSRC severity and release date
Security assessment
The examples demonstrate filtering security updates with critical severity, which documents security-related patch management features but does not address a specific vulnerability
Diff
diff --git a/code-library/latest/ug/ssm_example_ssm_DescribeAvailablePatches_section.md b/code-library/latest/ug/ssm_example_ssm_DescribeAvailablePatches_section.md index 22a15bbf0..6a834bad3 100644 --- a//code-library/latest/ug/ssm_example_ssm_DescribeAvailablePatches_section.md +++ b//code-library/latest/ug/ssm_example_ssm_DescribeAvailablePatches_section.md @@ -171,0 +172,65 @@ PowerShell +**Tools for PowerShell V5** + + +**Example 1: This example gets all available patches for Windows Server 2012 that have a MSRC severity of Critical. The syntax used by this example requires PowerShell version 3 or later.** + + + $filter1 = @{Key="PRODUCT";Values=@("WindowsServer2012")} + $filter2 = @{Key="MSRC_SEVERITY";Values=@("Critical")} + + Get-SSMAvailablePatch -Filter $filter1,$filter2 + + +**Output:** + + + 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 + ... + +**Example 2: With PowerShell version 2, you must use New-Object to create each filter.** + + + $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 + + +**Example 3: This example fetches all the updates which are released in last 20 days and applicable to products matching WindowsServer2019** + + + Get-SSMAvailablePatch | Where-Object ReleaseDate -ge (Get-Date).AddDays(-20) | Where-Object Product -eq "WindowsServer2019" | Select-Object ReleaseDate, Product, Title + + +**Output:** + + + 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) + + * For API details, see [DescribeAvailablePatches](https://docs.aws.amazon.com/powershell/v5/reference) in _AWS Tools for PowerShell Cmdlet Reference (V5)_. + + + +