Slick script. Note that for the registry option to work, the system's
remote registry service must be running. Otherwise, the script will
return:
Unable to open Uninstall key:  at installed_apps.pl line 124. 



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
$Bill Luebkert
Sent: Thursday, December 09, 2004 5:52 PM
To: [EMAIL PROTECTED]
Cc: Perl-Win32
Subject: Re: get a list of installed programs and path to exe.

[EMAIL PROTECTED] wrote:

> Hi there,
> 
> in windows xp/2000 how do i get a list of all installed programs and
paths to exe?

This may help - you can choose registry or WMI :

#!perl -w --

use warnings;
use strict;
use WIn32::OLE qw(in);
use Data::Dumper; $Data::Dumper::Indent=1;

our %A;         # get commandline switches into %A
for (my $ii = 0; $ii < @ARGV; ) {
        last if $ARGV[$ii] =~ /^--$/;
        if ($ARGV[$ii] !~ /^-{1,2}(.*)$/) { $ii++; next; }
        my $arg = $1; splice @ARGV, $ii, 1;
        if ($arg =~ /^([\w]+)=(.*)$/) { $A{$1} = $2; } else { $A{$1}++;
} }

(my $prog = $0) =~ s/^.*[\\\/]//;
my $usage = <<EOD;

Usage: $prog [-d] {-w|-r} [<host> ... ]
        -d      debug
        -w      use WMI
        -r      use registry
        <host>  list of hosts to dump installed software for

EOD
die $usage if $A{h} or $A{help};

my $debug = $A{d} || 0;
my $use_reg = $A{r} || 0;
my $use_WMI = $A{w} || 0;

if ($use_WMI) {

        my $mach = shift || Win32::NodeName;
        my $objWMI =
Win32::OLE->GetObject("winmgmts:{impersonationlevel=impersonate}!//$mach
");
        my $products = $objWMI->ExecQuery("select Name, Version,
InstallDate, IdentifyingNumber from Win32_Product");
>snip!<

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to