Windows Develop Bookmark and Share   
 index > Windows Forms Sample Applications > Windows Update
 

Windows Update

How to update windows like windows automatic update using C#?

Thanks

Bose

Subash Bose  Monday, December 24, 2007 12:04 PM

As far as I know you cannot do that.

Best Regards and Happy New Year

Zhi-xin Ye

Zhi-Xin Ye  Thursday, December 27, 2007 11:35 AM

As far as i know you can do this with WSH, so its in the computer somewhere Smile I am looking at this right now to implement this in a C# app.

This was some of the "code" in my old WSH script:

Set objSysInfo = CreateObject("Microsoft.Update.SystemInfo")
Set objSession = CreateObject("Microsoft.Update.Session")
Set objSearcher = objSession.CreateUpdateSearcher
Set objResults = objSearcher.Search("Type='Software' and IsInstalled=0")
Set colUpdates = objResults.Updates

BR

Daniel Tiru

DTiru  Wednesday, January 23, 2008 12:51 PM

Does anyone know how to find when a system needs a reboot after being patched? I would like to generate a list

of systems that need a reboot, but can't find a registry setting or something I might be able to query using code.

Maybe its stored on the WSUS SVR in a SQL table?

Any ideas ?

I found thisVB script codein the script center but it can not be run against remote systems.

This is supposed to help detect if a system needs to be rebooted. I have not been able to verify if this actually works

becauseI have to find a system in this state to test it.

(Just place this in a Text file with notepad and call it wsusreboot.vbs. )

Set objSysInfo = CreateObject("Microsoft.Update.SystemInfo")

If objSysInfo.RebootRequired Then
Wscript.Echo "This computer needs to be rebooted."
Else
Wscript.Echo "This computer does not need to be rebooted."
End If

Gary Schmitt  Friday, February 08, 2008 1:50 PM

That code works well i think:

This code works well anyway...

Set objInstaller = CreateObject("Microsoft.Update.Installer")
Set objInstallResults = objInstaller.Install
inRebootRequired = objInstallResults.RebootRequired

But as you say, this is a local object, what i suggest as i dont know how to get this information and havent had time to figure it out is to make this a vbs, schedule it on each machine and push the info to a db somewhere...

Or figure out how and if this information is avail trough WMI, it must be...

Cheers

Daniel Tiru

a-Tiru-  Friday, June 13, 2008 11:36 AM

You can use google to search for other answers

Custom Search

More Threads

• Movement angle and speed.
• RAR / UNRAR
• EngineSettings
• task notification service?
• How to Determine my Eyesight Radius
• Right Click Events
• Provider Pattern is here
• Anyone still playing this game?
• TaskVision's Login/Ticket handler
• DesignVision