List of all installed applications (XP)?

G

Guy Lateur

Hi all,

I'm trying to generate a (exhaustive) list of all the applications that are
installed on a user's machine. I've written some code that reads the
registry ('App Paths'):

<code>
appKey = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE,
'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths', 0, win32con.KEY_READ)
sklist = win32api.RegEnumKeyEx(appKey)

for skey in sklist:
print skey[0]

try:
wPath = win32api.RegQueryValue(appKey, skey[0])
print ' ' + wPath
except pywintypes.error,details:
print '### Error [pywintypes.error]: ' + details[2]

win32api.RegCloseKey(appKey)
</code>

This works, but I was wondering wether that is the best way to go about
this? Can I be sure it lists *all* the applications? What does it mean when
a pywintypes.error is thrown (code 13, 'Invalid data')?

Thanks,
g
 
P

Paul McGuire

Get Tim Golden's wmi module
(http://tgolden.sc.sabren.com/python/wmi.html). I recently had to help
my brother remove some spyware, and so I used some of the example that
came with WMI to read through the registry to extract startup keys,
services, etc.

Even if your users aren't sophisticated enough to mess with the
registry, rest assured that the software installation programs are.
You should be able to find traces of any installed commercial program
that was released in the past 5 years - I suspect they *all* leave
traces in the registry at this point. Go to
HKEY_LOCAL_MACHINE\SOFTWARE and you will get a list of software
vendors, and you can enumerate keys from there.

Good luck!
-- Paul
 
D

Dennis Lee Bieber

This works, but I was wondering wether that is the best way to go about
this? Can I be sure it lists *all* the applications? What does it mean when
a pywintypes.error is thrown (code 13, 'Invalid data')?
"All" applications? No... Only those that create registry
entries...

I installed the Eclipse Java IDE, and I'm pretty sure it didn't
do anything with the registry (no "start menu" entry, etc. -- one just
has to know where to find the startup program by hand).

--
 
G

guy lateur

| [TJG]
| Hmmm. While I understand your requirement, it's not as
| thought there's some easily-discernible charactersistics
| of "commercial software packages which should have licenses
| but which don't"

No? Really? How disappointing.. ;)


| [TJG]
| By the sound of it, you're almost better off compiling
| a list of .exe from machines and building up a blacklist
| from those.

That was kind of the idea at first. However, we have a file server (H:), and
I've seen apps installed on it. So it's pretty hard to know who actually
uses that app just by the .exe - could be several people, too, I guess.
That's why I thought of the registry - which, as you rightfully pointed out,
isn't a perfect strategy, either.

I do understand that I can remove those apps by removing the .exe (+
containing folder, probably), but I'd also like to get an idea of who is
using what right now (and why). That might come in handy at some point later
on. Btw, is there a module called pyWhy or something? :)

Maybe I should also follow Paul's advice and go through the registry on a
vendor/app basis. I mean, ATM, I'm not really concerned about a user having,
say, Cubase installed without a license. My priority right now is to make
sure we have licenses for certain apps we use professionally/commercially
(ACad, Office, ..).


Thanks for the input, people, much appreciated,
g
 
N

Neil Hodgson

Not only is it difficult to tell which applications are installed,
it is difficult to tell if an application is still installed as all too
many applications do not remove all their registry keys upon uninstall.

I was going to suggest using a commercial application due to the
messiness of this problem but the one I tried "Tally Systems WebCensus"
(now owned by Novell) failed to find NuMega BoundsChecker and it also
believes Yahoo Messenger is still installed even though it was uninstalled.

Neil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top