r/PowerShell • u/Pimzino • Apr 03 '24
OpenSource PSWindowsUpdate alternative OpenWindowsUpdate
Hi All,
I am an IT professional with around 8 years of PowerShell experience. I have previously built modules / functions for the business I work for and PSWindowsUpdate is something we have used on and off for sometime. Specifically for client patching during an OSProvisioning phase.
We have found multiple issues with module more times than not and with the module being closed source it is difficult to see / contribute to PSWindowsUpdate so therefore we are left in the dark with a non-working module. Issues we have come across are countless, sometimes the module returns a HRESULT error which when looking online provides little to no information, other times it supposedly completes fine however when checking the logs the updates failed to install with no error messages etc. I could go on for hours.
Now the way I see it, PowerShell is made by Microsoft which in no way is a company known for releasing OpenSource tooling however I have always viewed PowerShell as being a community driven language / tool with a ton of flexibility.
My proposal here is that I would like to start a whole new project, one maintained by the community for the community that we can all enjoy and contribute to. The project will be completely open source hosted on GitHub. This will basically be PowerShell functions that interact with the WindowsUpdate API (ComObjects). I have tested it with some 'dirty code' and it works.
What I am trying to understand is, if I start this project, will the community be interested in contributing to it with me as I wont have time to fully manage the project on my own. Please let me know.
I would add a Poll but Reddit wont let me.
17
u/MadBoyEvo Apr 03 '24
I actually started my own module, similar to PSWindowsUpdate. I have some ideas, but it's not yet ready to be shown. I'll probably release it later this year.
8
u/coaster_coder Apr 03 '24
Why not contribute to Chrissy LeMaireās KBUpdate module that works like 6,000% better than PSWindowsUpate does?
https://github.com/potatoqualitee/kbupdate
3
u/vermyx Apr 03 '24
The issue you point to here isnāt really a module issue. HRESULT isnāt an error it is a return code and the standard that is used for the most part with the windows API. Typically 0 is successful and non-zero points to an error code which can be deciphered via the windows api or using the errlookup.exe utility. The biggest issue is that people dont translate the return code to hex which will return more hits than the integer. The HRESULT code is usually coming back from the COM object that windows update uses which is also what pswindowsupdate uses. Making that code āfriendlierā may help but most of the time those errors are related either to activation issues or a corrupt local update database.
2
u/BlackV Nov 15 '25
so /u/Pimzino we're a year in, how'd it go ?
2
u/Sunsparc Apr 03 '24
I'd certainly be interested. Been finagling PSWindowsUpdate for a couple years now and it certainly has its short comings and frustrations.
1
u/[deleted] Apr 03 '24
I was actually just trying to crack open PSwindowsupdate and see how it works under the hood lol.
I'm having issues where I have a client that is not able to install updates on a device with our tooling. I want to install updates with a script instead but they are blocked from getting pswindowsupdate.
When I can run it the module is pretty good though. Honestly I don't think the issues you're having are with the module. Windows update can be cryptic and esoteric with the feedback it gives. The module writer can't really do anything to fix that.
1
u/BlackV Apr 03 '24 edited Apr 03 '24
you can alternatively use the native CIM cmdlets to run windows updates
PSWindowsUpdate, is one of the most downloaded modules in the world, I'm happy for the author to carry on their work
Top package downloads (last 6 weeks):
2
u/mtniehaus Apr 04 '24
I finally just switched over to the Windows Update COM objects -- for what I needed, PSWindowsUpdate was overkill.
Sample:
https://github.com/mtniehaus/UpdateOS/blob/main/UpdateOS/UpdateOS.ps1#L108
2
u/MechaCola Apr 04 '24
For all the same reasons I created my own , havent had the time to update it in awhile but it really wasnāt too bad to get going. Lots of documentation on the api
1
u/jeek_ Apr 04 '24
I recently started something similar and would be happy to share / get involved.
I found a workaround for the issue where you can't invoke the com object remotely, so I've been testing that.
Alternatively, there is this, https://github.com/adbertram/PSWinUpdate
1
u/jsiii2010 Apr 04 '24
What module do I use then, lol? I have little scripts that use the com object.
1
u/AATW_82nd Sep 17 '24
I've been using PSWindowsUpdate and been fairly successful when used on computers before AutoPilot. What I can't figure out is how can I block 24H2 from installing, at least for now? I've tried filtering with Title -notlike, but I keep getting into a loop when installing the last cumulative update. Any suggestions?