Windows Update: detect if important updates available

Get help with using AutoHotkey and its commands and hotkeys
User avatar
jeeswg
Posts: 4506
Joined: 19 Dec 2016, 01:58
Location: UK

Windows Update: detect if important updates available

10 Jan 2017, 18:51

I am looking for a way to detect if there are
important updates available on Windows 7, or on Windows generally.

I have had problems with various methods so far:
- FindWindow: works on Windows XP, doesn't work on Windows 7
- check system tray icons: fiddly, and the method varies depends on the Windows version
- ComObjCreate("Microsoft.Update.Session"): extremely slow or doesn't work
- Run, control /name Microsoft.WindowsUpdate: cannot be run as a hidden window

Btw on Windows XP I could check for Windows updates via:

Code: [Select all] [Download] GeSHi © Codebox Plus

^q::
if (A_OSVersion = "WIN_XP")
if DllCall("FindWindow", "str", "wuauclt_icon", "uint", 0)
MsgBox NOTE: WINDOWS UPDATES AVAILABLE
Return


I used the Windows XP method on a backup script, that notified you of any updates,
at the point where it asked if you wanted to shutdown/restart after backup.
User avatar
jeeswg
Posts: 4506
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Windows Update: detect if important updates available

15 Jan 2017, 00:57

Well the current best solution I have is now:
- JEE_ExpGetSystrayItems uses Acc to list the names of the systray items.
- JEE_ExpUpdatesAvailable then checks for the text 'New updates are available'.
- (JEE_ExpGetTaskbarItems is a similar function to the systray one.)

I would still be interested in any other methods, maybe via objects or via a system dll call. But this solution is pretty good.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

User avatar
jeeswg
Posts: 4506
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Windows Update: detect if important updates available

28 Sep 2017, 04:17

Getting Windows Update information via Microsoft.Update.Session:

In the past this had taken about 6 minutes, but testing just now around half to one minute. I would be grateful if anyone has a quick method that simply checks if there are updates available e.g. that a little yellow icon will appear by the Start button.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



Links:
Searching, Downloading, and Installing Updates (Windows)
https://msdn.microsoft.com/en-us/library/aa387102
IUpdate interface (Windows)
https://msdn.microsoft.com/en-us/library/windows/desktop/aa386099(v=vs.85).aspx
Last edited by jeeswg on 28 Sep 2017, 05:19, edited 1 time in total.
BoBo
Posts: 2515
Joined: 13 May 2014, 17:15

Re: Windows Update: detect if important updates available

28 Sep 2017, 04:47

(New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
... stolen from [here]. Hope that helps :?: :!:
User avatar
jeeswg
Posts: 4506
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Windows Update: detect if important updates available

28 Sep 2017, 05:27

Thanks BoBo. From what I read that will start updates, this other line below brings up a little dialog.

Code: [Select all] [Download] GeSHi © Codebox Plus

q::
;ComObjCreate("Microsoft.Update.AutoUpdate").DetectNow()
ComObjCreate("Microsoft.Update.AutoUpdate").ShowSettingsDialog()
return

Return to “Ask For Help”

Who is online

Users browsing this forum: Kenpt5u, newbieforever, Pardeep Tariyal, Pilu, rooneysoccer and 10 guests