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.
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.
The Microsoft Script Repository has a script for listing all installed software.
C#.net code for getting the list of installed software using WMI in xp and win7(wmi is the only way in win7)
The best registry-based implementation that I have seen is the one written by Chris Wright (chris128) posted at http://www.vbforums.com/showthread.php?t=598355. It uses multiple registry keys and is a lot more complex than any of the answers currently posted here. It seems to produce identical results to the Add/Remove Programs app, and like the ARP app it also provides an option to include updates.
Although it's implemented in VB.NET, it should be easy to convert to other .NET languages like C# or IronPython. I imagine that converting to IronPython first should make it fairly easy to port to regular Python if that's what you want, but I only converted it to C# myself and then cleaned up the code a bit.
Only one small bug to point out: GetUserInstallerKeyPrograms() doesn't add the version for user programs to the list, even though it extracts it. This is easy to fix though.
Control Panel uses Win32 COM api, which is the official method (see Google Groups, Win32)
Never rely on registry.
I know this question is old, the OP mentioned XP and also mentioned Python, C or C++ but I found that a lot of information on the net about this topic is either incomplete or incorrect. An example of the latter is the suggestion to use WMI--specifically, the
Win32_Product
class; however, as is noted elsewhere, that method is slow, partly because, believe it or not, each MSI found actually runs its repair. I call that solution incorrect because of how painfully slow it is and because of its nasty side-effect. For instance, you have already opted to disable a program's Windows service but callingselect * from Win32_Product
, as part of ensuring that the MSI repair runs, will apparently re-enable the service.For what it's worth, below is what I would consider to be the most complete example to date, albeit in C# (I compiled it against Framework 4.6.1 but lower versions may work too.) It lists 32-bit and 64-bit installed programs; it disposes registry keys that it uses and it runs in under a second, at least after caching kicks in. If you can offer improvements, please suggest them instead of just downvoting, and I will update the code.
One thing it is still missing is some updates. For example, when I run it on my Windows 10 system and compare it with Control Panel | Programs and Features | Installed Updates, I notice that it does not show
Security Update for Adobe Flash Player
for some reason.I don't have any good reason for the anonymous method, it's just how I was thinking at the time--a sort of method-within-a-method solution.
[Sigh] and then I saw @PolyTekPatrick's answer. How did I miss that? LOL
Check out the Win32_Product WMI (Windows Management Instrumentation) class. Here's a tutorial on using WMI in Python.