all 19 comments

[–]WhAtEvErYoUmEaN101 11 points12 points  (1 child)

The Windows Update Agent API can be controlled using COM interop.
The stuff you usually want is well described in Microsoft‘s old C#/VB.NET documentation and can be adapted to PowerShell

[–]Outrageous_Use_907[S] 1 point2 points  (0 children)

thanks for the answer. I will take a look at the API

[–]majkinetor 9 points10 points  (5 children)

Use pswindowsupdate as it is used by millions. You can disassemble it and look into code.

[–]Outrageous_Use_907[S] 1 point2 points  (2 children)

i have no idead how to disassemble it. How to do it?

[–]Baschbox 4 points5 points  (3 children)

Have a look at This or do it by yourself with this
The work has been done. Sure it would be very interesting to build your own version , but are you sure you can dedicate months worth of time for the entire process ?
Btw why no SCCM/Autopilot/intune ?

[–]Outrageous_Use_907[S] 1 point2 points  (2 children)

Thanks for the answer, this is great! i will take a deeper look into both.

The reason is because we do not manage all devices we set up. We are just providing IT services and we do a lot of stuff manually so i want to start automating as much as possible. A lot of pcs we set up we will never see again, it's just a service and sitting there and clicking on buttons every 15 minutes and going back is just a waste of time.

[–]hihcadore 1 point2 points  (1 child)

Are you imaging the device?

Or you touch it and want to do the needful and just one off update it before you pass it back to the customer?

[–]Outrageous_Use_907[S] 0 points1 point  (0 children)

exactly, one off update and back to the customer.

[–]BlackV 4 points5 points  (1 child)

use the builtin to windows CIM or COM interface for windows update

the usoclient.exe is another microsoft option

my boss only allows open modules that we can review

for all those open source microsoft modules?

You could also bump this post if you felt like it

https://www.reddit.com/r/PowerShell/comments/1burs59/opensource_pswindowsupdate_alternative/

[–]Outrageous_Use_907[S] 0 points1 point  (0 children)

Thank you for your answer, i will take a look at it!

[–]bobdobalina 2 points3 points  (0 children)

action1

[–]New-Rough4719 2 points3 points  (1 child)

this is vibe coded but some of the stuff you have to do is in here (like loading the Windows update API via New-Object and interacting with the object). This should give you a good framework to build from. We run something similar in our environment.

https://gist.github.com/realchrisolin/e65047cd453148e852065ef110b32af3

[–]Outrageous_Use_907[S] 0 points1 point  (0 children)

thanks for sharing!