Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I enumerate/list all installed applications in Windows XP?

When I say "installed application", I basically mean any application visible in [Control Panel]->[Add/Remove Programs].

I would prefer to do it in Python, but C or C++ is also fine.

like image 914
sharkin Avatar asked Apr 29 '09 14:04

sharkin


2 Answers

The Microsoft Script Repository has a script for listing all installed software.

import win32com.client
strComputer = "."
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
objSWbemServices = objWMIService.ConnectServer(strComputer,"root\cimv2")
colItems = objSWbemServices.ExecQuery("Select * from Win32_Product")
for objItem in colItems:
    print "Caption: ", objItem.Caption
    print "Description: ", objItem.Description
    print "Identifying Number: ", objItem.IdentifyingNumber
    print "Install Date: ", objItem.InstallDate
    print "Install Date 2: ", objItem.InstallDate2
    print "Install Location: ", objItem.InstallLocation
    print "Install State: ", objItem.InstallState
    print "Name: ", objItem.Name
    print "Package Cache: ", objItem.PackageCache
    print "SKU Number: ", objItem.SKUNumber
    print "Vendor: ", objItem.Vendor
    print "Version: ", objItem.Version
like image 170
John Fouhy Avatar answered Oct 28 '22 08:10

John Fouhy


If you mean the list of installed applications that is shown in Add\Remove Programs in the control panel, you can find it in the registry key:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall

more info about how the registry tree is structured can be found here.

You need to use the winreg API in python to read the values from the registry.

like image 42
Aziz Avatar answered Oct 28 '22 09:10

Aziz