One of the breaking changes that comes along with PowerShell 5.0 is
What is OneGet? Oneget is a package providers source aggregator, a unified package management tool like APT is on Linux.
To get a better understanding of what
OneGet PackageManagement is, I’d recommend you read these two posts:
- Introducing PackageManagement in Windows 10
- 10 things about OneGet that are completely different than you think.
To get my hands-on this new tool on Christmas holidays, I wrote a prototype for the Windows Update Agent (WUA) provider that can query dynamically updates from locally registered sources: Windows Update (by default), Microsoft Update (after opt-in), WSUS, the Windows Store,… Unfortunately, I can’t present this code as it’s too clunky with the latest PackageManagements builds over the last 6 months. To get things working smoothly, I revised the code and tried to keep it simple. This post will present a Windows Update Agent provider that exclusively queries only 1 source: Windows Update. It could probably meet the following expectations recently reported on MS connect website:
Let’s see how this provider works:
- List package providers and sources available on the box
- List what was installed from Windows Update on the box
Get-Package -ProviderName WUA
Find-Package -Source 'Windows Update' | Install-Package
Bonus: To be able to see what happens behind the scene and be able to choose and confirm the updates you want to install, you can do:
Find-Package -Source 'Windows Update' -Debug | Install-Package -Debug
I’ve hosted the Windows Update Agent provider for Windows Update on github using this link: https://github.com/p0w3rsh3ll/OneGetWUAProvider
By the way, I’m not the only one who writes PackageManagement providers using PowerShell.
Windows PowerShell MVP Doug Finke already wrote two providers for gist and github that inspired me and helped me while working on mine 😀