List of all installed applications (XP)?

2005-06-23 Thread 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



-- 
http://mail.python.org/mailman/listinfo/python-list


RE: List of all installed applications (XP)?

2005-06-23 Thread Tim Golden
[Guy Lateur]
| 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'):

[.. snip code ..]

| Can I be sure it lists *all* the applications?

What -- from your point of view -- is an application? I can pretty
much guarantee that by no means does every app install an AppPath: it's
merely a convenience. Neither does every app have an Add/Remove Program
entry. (And some things have entries which aren't apps). And where do
you draw the line between some arbitrary executable and an app?

Just asking, because I don't think you can do anything exhaustive
until you know the scope you're trying to exhaust.

TJG


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: List of all installed applications (XP)?

2005-06-23 Thread Guy Lateur
| What -- from your point of view -- is an application?

Good question. Let me try to elaborate: I would like to know if people in 
our company (building techniques) are using non-licensed software (eg 
Photoshop, Office, AutoCad). So I guess by 'application' I mean commercial 
software packages like those.

Is it safe to assume those apps get listed in AppPath? I don't think my 
users are cunning enough to mess with the registry, so I guess we're talking 
about the 'standard' installation.



| Neither does every app have an Add/Remove Program
| entry. (And some things have entries which aren't apps).

Just out of curiosity: can one read the info/list one gets in Add/Remove 
Programs? It's not a problem I get results that aren't actually apps, but it 
is important I get all apps.



Thanks,
g




-- 
http://mail.python.org/mailman/listinfo/python-list


RE: List of all installed applications (XP)?

2005-06-23 Thread Tim Golden
[Guy Lateur]
| 
| | [TJG]
| | What -- from your point of view -- is an application?
| 
| Good question. Let me try to elaborate: I would like to know 
| if people in 
| our company (building techniques) are using non-licensed software (eg 
| Photoshop, Office, AutoCad). So I guess by 'application' I 
| mean commercial software packages like those.

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 unless you're prepared to compile a list
and to add to it over time.

| Is it safe to assume those apps get listed in AppPath? 

I wouldn't have said so: AppPaths is basically useful if
you want to be able to go Start  Run  blah.exe without
having to hunt through Program Files etc. Since many
apps simply set up a Start Menu shortcut, there's no
need for this.

| Just out of curiosity: can one read the info/list one gets in 
| Add/Remove 
| Programs? It's not a problem I get results that aren't 
| actually apps, but it 
| is important I get all apps.

I honestly don't know: I imagine Googling around will
give some hits (for the question in general and for
Add/Remove in particular): it can hardly be an unheard
of issue. If someone's solved it in one way, it's
almost certainly possible to translate that to Python
(or to use their tool, if it's accessible).
I have an idea it's held in the registry, but I'm not sure.
You could try running up regedit and searching for likely
strings.

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

TJG


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: List of all installed applications (XP)?

2005-06-23 Thread Thomas Heller
Guy Lateur [EMAIL PROTECTED] writes:

 | What -- from your point of view -- is an application?

 Good question. Let me try to elaborate: I would like to know if people in 
 our company (building techniques) are using non-licensed software (eg 
 Photoshop, Office, AutoCad). So I guess by 'application' I mean commercial 
 software packages like those.

 Is it safe to assume those apps get listed in AppPath? I don't think my 
 users are cunning enough to mess with the registry, so I guess we're talking 
 about the 'standard' installation.



 | Neither does every app have an Add/Remove Program
 | entry. (And some things have entries which aren't apps).

 Just out of curiosity: can one read the info/list one gets in Add/Remove 
 Programs? It's not a problem I get results that aren't actually apps, but it 
 is important I get all apps.


I think it's this registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

Maybe you should try HKEY_CURRENT_USER\.. or HKEY_USERS\..\.. as well.

Thomas
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: List of all installed applications (XP)?

2005-06-23 Thread 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

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: List of all installed applications (XP)?

2005-06-23 Thread 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


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: List of all installed applications (XP)?

2005-06-23 Thread 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
-- 
http://mail.python.org/mailman/listinfo/python-list