By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,720 Members | 2,095 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,720 IT Pros & Developers. It's quick & easy.

List of all installed applications (XP)?

P: n/a
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

Jul 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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

Jul 19 '05 #2

P: n/a
On Thu, 23 Jun 2005 10:11:36 GMT, "Guy Lateur" <gu********@b-b.be>
declaimed the following in comp.lang.python:

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).

-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Jul 19 '05 #3

P: n/a
| [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
Jul 19 '05 #4

P: n/a
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
Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.