Pergunta

I can read list of installed applications from registry:

@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" 

and on Vista and 7

@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"

But in Vista when I click View Installed Updates list of updates is showed. How to read this list of updates from registry ? In this updates is Internet Explorer and I have to read it too. Key @"SOFTWARE\Wow6432Node\Microsoft\Updates" contains only three updates but in the list in Control Panel -> Programs and Features there is more applications and updates. How to read them all from registry ?

Thanks

Foi útil?

Solução

Using WMI is the correct approach to the problem. Specifically, the Win32_QuickFixEngineering class is the one that you want.

This should work just fine on Windows Vista. Your problem stems from the fact that starting with Windows Vista, the updates installed by Component Based Servicing (CBS) are not listed in the registry.

Sample VBScript code:

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")
Set colQuickFixes = objWMIService.ExecQuery _
    ("Select * from Win32_QuickFixEngineering")
For Each objQuickFix in colQuickFixes
    Wscript.Echo "Description: " _
        & objQuickFix.Description
    Wscript.Echo "Hotfix ID: " & objQuickFix.HotFixID
Next

A Google search reveals that some kind individual has already written a complete VBScript to obtain this information. It even formats the output as a beautiful HTML file.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top