I want to extract a specific keyword from a variable like desired output.
$CU2016 = $Hotfixes| Where-Object { $_.Title -like '*Cumulative Update for Windows Server 2016*'}
$CU2019 = $Hotfixes| Where-Object { $_.Title -like '*Cumulative Update for Windows Server 2019*'}
$CU2022 = $Hotfixes| Where-Object { $_.Title -like '*Cumulative Update for Microsoft server operating system version 21H2*'}
$CUWIN10 = $Hotfixes| Where-Object { $_.Title -like '*Cumulative Update for Windows 10 Version 22H2*'}
My desired output :
KB5036899
KB5036896
KB5037033
KB5036892
Inside of Hotfixes variable :
Title
-----
2024-04 Cumulative Update for Windows Server 2016 for x64-based Systems (KB5036899)
2024-04 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5036896)
2024-04 Cumulative Update for Microsoft server operating system version 21H2 for x64-based Systems (KB5036909)
2024-04 Cumulative Update for .NET Framework 3.5, 4.8 and 4.8.1 for Microsoft server operating system version 21H2 for x64 (KB5037033)
2024-04 Cumulative Update for Windows 10 Version 22H2 for x64-based Systems (KB5036892)