The Other Worlds Shrine

Your place for discussion about RPGs, gaming, music, movies, anime, computers, sports, and any other stuff we care to talk about... 

  • Question (Perl, Python, whatever)

  • Somehow, we still tolerate each other. Eventually this will be the only forum left.
Somehow, we still tolerate each other. Eventually this will be the only forum left.
 #122481  by Lox
 Wed Jun 04, 2008 11:39 am
Do any of you guys know how to use Perl or Python or some other scripting language to see if an application is installed and what version is installed? I'd like the info visible from the Add/Remove Programs screen, but I'm having a heck of a time figuring out where that lives in the registry. If I can find it there, I know I can do this rather easily. Maybe there's some other place I can check...not sure.

My goal is to write a script that will go out and check for a specific installed application on a few thousand remote PCs.

 #122482  by Kupek
 Wed Jun 04, 2008 12:11 pm
That kind of information is exposed through the Windows API. It might be easier to use the .NET framework since that has a more coherent API than Win32.

 #122483  by Lox
 Wed Jun 04, 2008 1:10 pm
Good point.
That might end up being easier in the long run.

It wouldn't be a big deal if I didn't need the version number. I could just check for the install folder, but I'd really like the version info for my report also.

 #122499  by SineSwiper
 Wed Jun 04, 2008 7:28 pm
Well, you also run into the hurdle of needing to install the application that checks on the application. Or having to install Perl/.NET/etc. on the PC first.

It sounds like you need to buy LANdesk or something similar first. If you're managing a few thousand PCs, you need the right tools to do so. Just have everybody install that and you won't have to worry about "Gee, does this PC have this application on there or not?"

I'm a huge advocate for buying the right tools to support your operation. If you try to jury-rig some script to do one function or another, that band-aid ends up being the final solution to the problem. Now, you're stuck a few ways: 1. you have to support that script, 2. you will be asked a thousand times to modify that script, and 3. if you leave, the company is stuck with a script that nobody supports.

Sometimes that's hard because they bitch "well, we don't have the money for that" or "I don't think it's in the budget for this year", but push for the tools and push hard. Resist support for the role if that role does not include the proper tools to do the job. (It gets the message across to have everybody in the department say "Well, gee, I could do X, but I don't exactly have tool Y to do that easily" every time somebody asks about X.)

Trying to cut a piece of wood with a butterknife is fucking stupid. Therefore, you should spring for the money for the table saw and do the job correctly.

 #122511  by Lox
 Wed Jun 04, 2008 10:03 pm
Installing something like LANdesk is overkill for what I need (and for what the company needs really). My goal is to gather some info that could be available somewhere else, but I don't necessarily trust it without gathering it myself.

This is going to be minimally run (once this time by me, maybe once sometime next year before we deploy our app) so I'm not worried about updating it or supporting it. It's kind of a throw away tool.

The reason I was going to use Perl was because we already have a handful of scripts that pull data from workstations in the field and do other stuff, so checking for an installed app shouldn't be too complicated if there's a simple way to check. Apparently the app will appear in the registry with uninstall info including the visible version. I can easily pull data from the registry using perl.

Don't get me wrong...I agree with your overall post about using the right tools for the job. :) I just disagree with it for this app, but I didn't really give that much detail so you wouldn't have known anyhow.

 #122532  by SineSwiper
 Thu Jun 05, 2008 5:17 pm
I dunno. We only have about a few thousand employees, and LANdesk is a pretty good tool.

Anyway, I haven't played around with reg edits/looks from Win32 version of Perl (ActivePerl). There might even be some shell scripting to use for that note as well.

Looks like you could even do this from JavaScript.

 #122554  by Lox
 Fri Jun 06, 2008 8:08 am
Yeah, it sounds like a pretty good tool. One thing all of our apps do though (I just though of this now actually) is that they send status info to a central registry every day. So we have a pretty good picture of which apps are installed on which workstations if we pick through the registry. The only downside is that you have to take the last update time into consideration if an app has stopped working or has been uninstalled or something. I'm not sure why we don't have a way to send an "uninstall" status to the registry to remove the item from the list.