Closed indychandi closed 2 years ago
I'm thinking about a parameter to specify "product" which could be used to filter out Azure HCI
So, since "Products" is already returned as a separate property in Get-MSCatalogUpdate
I think the best option here would just be to use Where-Object
.
Get-MSCatalogUpdate -Search "2022-05 Cumulative Update for Windows Server 2019 for x64-based Systems" | Where-Object { $_.Products -notcontains "Azure Stack HCI" }
Title Products Classification LastUpdated Version Size SizeInBytes Guid
----- -------- -------------- ----------- ------- ---- ----------- ----
2022-05 Cumulative Update Preview for Windows Server 2019 for x64-based Systems (KB5014022) Windows Server 2019 Updates 5/24/2022 2:07:46 PM n/a 575.6 MB 603516589 09665d85-29eb-46…
2022-05 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5015018) Windows Server 2019 Updates 5/19/2022 2:07:46 PM n/a 563.8 MB 591165636 4df17d58-afca-4e…
2022-05 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5013941) Windows Server 2019 Security Updates 5/10/2022 2:07:46 PM n/a 563.7 MB 591056585 59152f2c-dbc8-4a… ```
Thanks - this worked. I did initially try filtering using "Title" and it wouldn't work - didn't think to use "Products"
When running the Get-MSCatalogUpdate search, it returns "Preview" and "Azure Stack HCI" updates. I can see there is already a branch being worked on to filter out "Preview", but can "Azure Stack HCI" also be filtered out? I am no expert in powershell, but I understand some people might want to allow to "Preview" and "Azure Stack HCI" updates, so maybe have it as an option to include/exclude these types of updates?
PS C:> Get-MSCatalogUpdate -Search "2022-05 Cumulative Update for Windows Server 2019 for x64-based Systems"
Title Products Classification LastUpdated Size
2022-05 Cumulative Update Preview for Windows Server 2019 for x64-based Systems (KB5014022) Windows Server 2019 Updates 2022/05/24 575.6 MB 2022-05 Cumulative Update Preview for Azure Stack HCI, version 20H2 and Windows Server 2019 Datacenter: Azure Edition for x64-based Systems (KB5014020) Azure Stack HCI Updates 2022/05/24 198.4 MB 2022-05 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5015018) Windows Server 2019 Updates 2022/05/19 563.8 MB 2022-05 Cumulative Update for Azure Stack HCI, version 20H2 and Windows Server 2019 Datacenter: Azure Edition for x64-based Systems (KB5013951) Azure Stack HCI Security Updates 2022/05/10 187.6 MB 2022-05 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5013941) Windows Server 2019 Security Updates 2022/05/10 563.7 MB
Expected output would just return the following:
2022-05 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5015018) Windows Server 2019 Updates 2022/05/19 563.8 MB 2022-05 Cumulative Update for Windows Server 2019 for x64-based Systems (KB5013941) Windows Server 2019 Security Updates 2022/05/10 563.7 MB