"Bateman, John \(IQAUS is\)" <[EMAIL PROTECTED]> writes:

> I then thought about the wmi, but am afraid have struck out there as
> well.  There are application classes, but none seem to identify what
> I am looking for.

Out of curiosity, what did you find was missing?

  
<http://msdn.microsoft.com/library/en-us/wmisdk/wmi/installed_applications_classes.asp>

Sample code to print the names and versions of all installed products
is below.  Note that this only works for products installed by the
Windows Installer Service.  This applies to Office 2000 and higher,
but I do not know about earlier versions.

 - Pat


use warnings;
use strict;
use Win32::OLE;

# Bomb out completely if COM engine encounters any trouble.
Win32::OLE->Option ('Warn' => 3);

# Get a handle to the SWbemServices object of the local machine.
my $moniker = 'WinMgmts:';
my $computer = Win32::OLE->GetObject ($moniker);
defined $computer
    or die "Unable to GetObject $moniker: $^E";

# Get the SWbemObjectSet of all installed products.  See:
# http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_product.asp
my $products_set = $computer->InstancesOf ('Win32_Product');

# Convert set to a Perl array.
my @products = Win32::OLE::Enum->All ($products_set);

foreach my $product (@products) {
    print "Name: $product->{'Name'}\n";
    print "Version: $product->{'Version'}\n";
    print "\n";
}

Reply via email to