PDA

Click to See Complete Forum and Search --> : Windows update location


weirddemon
May 30th, 2010, 08:51 PM
In my current application, I need to install some already downloaded Windows updates on a variety of different machines. Some machines already have these updates, some have a few, and others and have none at all.

I need to figure out how to determine which updates are installed.

Anyone have any ideas?

I searched for something like this some time ago, but came up with nothing.

I'm going to do some more looking, but if anyone has any ideas, I'd appreciate it.

Thanks

weirddemon
May 30th, 2010, 08:58 PM
Well... I just realized that they're located in the registry. I guess that's something I've known for a little while, but didn't think about it.

I would really hate to determine it by that method, so if anyone knows if any other method, that would be appreciated.

If there isn't, I'll just have to suck it up and play with the registry :p

weirddemon
May 30th, 2010, 09:32 PM
It turns out, when updates are installed, they get logged in a text file called WindowsUpdate located in the C:\Windows directory.

I should be able to just query that file.

weirddemon
May 30th, 2010, 10:03 PM
It turns out that doing a query on that file works perfectly.

It seems that "voicing" the issue was all that I needed to figure it out :p

chris128
May 31st, 2010, 06:54 AM
Does that definitely have ALL installed windows updates in and on all versions of Windows? I'm sure there will be something in the registry that is a little more reliable. I got my code here (http://www.vbforums.com/showthread.php?t=598355) getting most windows updates but on Windows 7 especially it seems to not get a lot of updates. Also, do you know how you are going to actually install the missing updates yet? If not, have a search on the forums for WUAPILIB :)

weirddemon
May 31st, 2010, 11:13 AM
Yeah. I don't want to have to use the registry since it can be slower and they're kind of all just scattered everywhere. But it looks like I'm going to have to.

The problem with the log file, I've found out, is that there doesn't seem to be a way to determine if the update has been installed. I'm currently checking it for the KB number, but it will be there regardless since it gets logged when it downloads.

I'm installing the updates via the WUSA.exe utility, which is easy and works perfectly.

weirddemon
May 31st, 2010, 12:11 PM
Ugh... this is becoming annoying. I wish this was straight forward =/

So, it looks like there are two places that I have found so far that MS stores the registry keys for updates.

HKLM\SofTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\ComponentDetect
HKLM\SofTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\ApplicabilityEvaluationCache

The first key looks like, if it's there, it's installed. The problem with this that a single update KB shows up several times within this key, so I'm not sure if this is reliable.

The second one is... confusing. Each update contains two DWORDs and I think their values determine if an update is pending or has been installed, but I don't think every update is their. If it was, that would make this sooooo easy. I could then just check the appropriate values and be done. But I don't think it will be that easy.

weirddemon
May 31st, 2010, 12:16 PM
Hm... it also looks like I could query WMI to determine if an update has been installed. That might be the easiest path, but definitely the slowest.

I guess the issue with WMI is that I can't seem to figure out which Class it's located within. I've seen some VBScripts that reference Microsoft.Update.Session, but that's not a WMI class. You can see it here (http://blogs.technet.com/b/heyscriptingguy/archive/2005/09/30/how-can-i-determine-if-a-particular-patch-is-installed.aspx).

Nightwalker83
May 31st, 2010, 07:59 PM
Which operating systems do the machines use?

Also, could please use the "Edit" button instead of posting on after the other of your posts. It can get very disorienting when seeing post after post by the same user all the time.

weirddemon
May 31st, 2010, 08:31 PM
I'm only focusing on Windows 7.

I chose not to edit so that those who are subscribed to the thread, would receive an update. I posted new things each time.

chris128
Jun 1st, 2010, 03:01 AM
Did you take a look at my "Enumerate Installed Programs" code? I think if you are going down the registry route then it might be a good place to start

weirddemon
Jun 1st, 2010, 12:20 PM
I've seen it before, but like you mentioned, most Windows 7 updates aren't there.\

I'll take another look when I get a chance.

chris128
Jun 1st, 2010, 12:53 PM
ah ok fair enough, I suppose I should really take a look at fixing it so that it does get all of the updates soon anyway