Is there any way to download Windows updates programmatically from within a C# application? I want to manage the installation of updates from within my application.
Asked
Active
Viewed 3,380 times
8
-
It is not a programming question! You should ask this in other stackexchange sites or other forums. – Mahdi Ghiasi Oct 31 '11 at 19:47
-
6@Mahdi, looks like a programming question to me. They're asking how to write software that downloads (and, presumably) installs updates. – Harry Johnston Oct 31 '11 at 19:50
-
maybe with WMI. or Powershell? – Glenn Ferrie Oct 31 '11 at 19:50
-
@Mahdi:I want to do it programmatic.I know I can click on Windows Update!!! but I want to do it and manage it – ahmadali shafiee Oct 31 '11 at 19:50
-
So, your question must be : How to download files in c#! – Mahdi Ghiasi Oct 31 '11 at 19:52
-
2The Windows Update API is documented at http://msdn.microsoft.com/en-us/library/aa387099%28v=VS.85%29.aspx – Harry Johnston Oct 31 '11 at 19:52
-
@HarryJohnston:Why don't you answer? – ahmadali shafiee Oct 31 '11 at 19:53
-
@Mahdi, downloading updates from Windows Update isn't the same as downloading a file from the web. For one thing, when downloading from Windows Update you don't know the URL. – Harry Johnston Oct 31 '11 at 19:55
-
@Mahdi:Windows updates aren't a File.They don't have any static address and Just windows can define that what update in for my windows and what update isn't – ahmadali shafiee Oct 31 '11 at 19:55
-
@ahmadali, I'm not sure whether that documentation actually answers your question, since it doesn't mention C#. Can you use a COM interface from C#? – Harry Johnston Oct 31 '11 at 19:57
-
@HarryJohnston: I think I have to add reference to WUA Come in my Project – ahmadali shafiee Oct 31 '11 at 20:00
-
@ahmadali shafiee - You would be correct. – Security Hound Oct 31 '11 at 20:05
-
@HarryJohnston:WUA COM Worked.Answer The Question – ahmadali shafiee Oct 31 '11 at 20:10
-
http://stackoverflow.com/questions/922132/use-c-sharp-to-interact-with-windows-update – N_A Oct 31 '11 at 20:11
1 Answers
6
The Windows Update API is documented here. A quick stackoverflow search has convinced me that you can indeed use COM from C# so this should solve your problem.
I also have some sample code, not in C#, but it may give you a head start in understanding how the interfaces can be used.

Harry Johnston
- 35,639
- 6
- 68
- 158